diff options
author | Andrew Chow <github@achow101.com> | 2022-11-15 19:40:25 -0500 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2022-11-15 19:53:04 -0500 |
commit | f0c646f026e652082e798800136dc06c734fdab6 (patch) | |
tree | f6018207a3b233a1c54b4cf944e91c21ede4f6cf /test | |
parent | 5602cc7ccf4a51ad52dadc495b732f54b43ceb99 (diff) | |
parent | fa84df1f033a5d1a8342ea941eca0b5ef73d78e7 (diff) | |
download | bitcoin-f0c646f026e652082e798800136dc06c734fdab6.tar.xz |
Merge bitcoin/bitcoin#25730: RPC: listunspent, add "include immature coinbase" flag
fa84df1f033a5d1a8342ea941eca0b5ef73d78e7 scripted-diff: wallet: rename AvailableCoinsParams members to snake_case (furszy)
61c2265629fdf11a2cc266fad54ceb0a1247bb5e wallet: group AvailableCoins filtering parameters in a single struct (furszy)
f0f6a3577bef2e9ebd084fe35850e4e9580128a9 RPC: listunspent, add "include immature coinbase" flag (furszy)
Pull request description:
Simple PR; adds a "include_immature_coinbase" flag to `listunspent` to include the immature coinbase UTXOs on the response. Requested by #25728.
ACKs for top commit:
danielabrozzoni:
reACK fa84df1f033a5d1a8342ea941eca0b5ef73d78e7
achow101:
ACK fa84df1f033a5d1a8342ea941eca0b5ef73d78e7
aureleoules:
reACK fa84df1f033a5d1a8342ea941eca0b5ef73d78e7
kouloumos:
reACK fa84df1f033a5d1a8342ea941eca0b5ef73d78e7
theStack:
Code-review ACK fa84df1f033a5d1a8342ea941eca0b5ef73d78e7
Tree-SHA512: 0f3544cb8cfd0378a5c74594480f78e9e919c6cfb73a83e0f3112f8a0132a9147cf846f999eab522cea9ef5bd3ffd60690ea2ca367dde457b0554d7f38aec792
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/wallet_balance.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/wallet_balance.py b/test/functional/wallet_balance.py index ec58ace4a2..60da22ca26 100755 --- a/test/functional/wallet_balance.py +++ b/test/functional/wallet_balance.py @@ -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) |