rpc: add utxo's blockhash and number of confirmations to scantxoutset output

This commit is contained in:
Luis Schwab
2024-07-23 18:20:35 -03:00
parent 8754d055c6
commit 17845e7f21
2 changed files with 17 additions and 4 deletions

View File

@@ -120,7 +120,15 @@ class ScantxoutsetTest(BitcoinTestFramework):
assert_equal(self.nodes[0].scantxoutset("status"), None)
assert_equal(self.nodes[0].scantxoutset("abort"), False)
# check that first arg is needed
# Check that the blockhash and confirmations fields are correct
self.generate(self.nodes[0], 2)
unspent = self.nodes[0].scantxoutset("start", ["addr(mpQ8rokAhp1TAtJQR6F6TaUmjAWkAWYYBq)"])["unspents"][0]
blockhash = self.nodes[0].getblockhash(info["height"])
assert_equal(unspent["height"], info["height"])
assert_equal(unspent["blockhash"], blockhash)
assert_equal(unspent["confirmations"], 3)
# Check that first arg is needed
assert_raises_rpc_error(-1, "scantxoutset \"action\" ( [scanobjects,...] )", self.nodes[0].scantxoutset)
# Check that second arg is needed for start