mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
RPC: listunspent, add "include immature coinbase" flag
so we can return the immature coinbase UTXOs as well.
This commit is contained in:
@ -77,8 +77,18 @@ class WalletTest(BitcoinTestFramework):
|
||||
self.log.info("Mining blocks ...")
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.generate(self.nodes[1], 1)
|
||||
|
||||
# Verify listunspent returns immature coinbase if 'include_immature_coinbase' is set
|
||||
assert_equal(len(self.nodes[0].listunspent(query_options={'include_immature_coinbase': True})), 1)
|
||||
assert_equal(len(self.nodes[0].listunspent(query_options={'include_immature_coinbase': False})), 0)
|
||||
|
||||
self.generatetoaddress(self.nodes[1], COINBASE_MATURITY + 1, ADDRESS_WATCHONLY)
|
||||
|
||||
# Verify listunspent returns all immature coinbases if 'include_immature_coinbase' is set
|
||||
# For now, only the legacy wallet will see the coinbases going to the imported 'ADDRESS_WATCHONLY'
|
||||
assert_equal(len(self.nodes[0].listunspent(query_options={'include_immature_coinbase': False})), 1 if self.options.descriptors else 2)
|
||||
assert_equal(len(self.nodes[0].listunspent(query_options={'include_immature_coinbase': True})), 1 if self.options.descriptors else COINBASE_MATURITY + 2)
|
||||
|
||||
if not self.options.descriptors:
|
||||
# Tests legacy watchonly behavior which is not present (and does not need to be tested) in descriptor wallets
|
||||
assert_equal(self.nodes[0].getbalances()['mine']['trusted'], 50)
|
||||
|
Reference in New Issue
Block a user