diff options
author | MacroFake <falke.marco@gmail.com> | 2022-09-08 08:56:05 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-09-08 08:56:09 +0200 |
commit | 2557429d2b82fe5ba308b940bcf14c3047634345 (patch) | |
tree | bdf5f58770ba7feef4cce3ed9a6f2e2b49f91d61 | |
parent | 37095c7dc4a85155c35e2473b6a20a53ae413cea (diff) | |
parent | 9f3a315c6f6af37d562a72f7d4fb2c53b5940871 (diff) |
Merge bitcoin/bitcoin#26037: test: Fix `wallet_{basic,listsinceblock}.py` for BDB-only wallets
9f3a315c6f6af37d562a72f7d4fb2c53b5940871 test: Fix `wallet_listsinceblock.py` for BDB-only wallets (Hennadii Stepanov)
1941ce6cd15a1123db8769d17a6fd9b1cb3debcc test: Fix `wallet_basic.py` for BDB-only wallets (Hennadii Stepanov)
Pull request description:
Fixes bitcoin/bitcoin#26029.
ACKs for top commit:
brunoerg:
crACK 9f3a315c6f6af37d562a72f7d4fb2c53b5940871
Tree-SHA512: d31c76e558dedea689ff487644e9f2d2f1df1cc2bb9bb041ede4b272884871167fdb19ccc717394c6ba6af8b8c70e9575b344988e0ce55b241a3a4922d0b7f73
-rwxr-xr-x | test/functional/wallet_basic.py | 63 | ||||
-rwxr-xr-x | test/functional/wallet_listsinceblock.py | 3 |
2 files changed, 34 insertions, 32 deletions
diff --git a/test/functional/wallet_basic.py b/test/functional/wallet_basic.py index 5d3d78c2dc..917721fef8 100755 --- a/test/functional/wallet_basic.py +++ b/test/functional/wallet_basic.py @@ -695,37 +695,38 @@ class WalletTest(BitcoinTestFramework): txid_feeReason_four = self.nodes[2].sendmany(dummy='', amounts={address: 5}, verbose=False) assert_equal(self.nodes[2].gettransaction(txid_feeReason_four)['txid'], txid_feeReason_four) - self.log.info("Testing 'listunspent' outputs the parent descriptor(s) of coins") - # Create two multisig descriptors, and send a UTxO each. - multi_a = descsum_create("wsh(multi(1,tpubD6NzVbkrYhZ4YBNjUo96Jxd1u4XKWgnoc7LsA1jz3Yc2NiDbhtfBhaBtemB73n9V5vtJHwU6FVXwggTbeoJWQ1rzdz8ysDuQkpnaHyvnvzR/*,tpubD6NzVbkrYhZ4YHdDGMAYGaWxMSC1B6tPRTHuU5t3BcfcS3nrF523iFm5waFd1pP3ZvJt4Jr8XmCmsTBNx5suhcSgtzpGjGMASR3tau1hJz4/*))") - multi_b = descsum_create("wsh(multi(1,tpubD6NzVbkrYhZ4YHdDGMAYGaWxMSC1B6tPRTHuU5t3BcfcS3nrF523iFm5waFd1pP3ZvJt4Jr8XmCmsTBNx5suhcSgtzpGjGMASR3tau1hJz4/*,tpubD6NzVbkrYhZ4Y2RLiuEzNQkntjmsLpPYDm3LTRBYynUQtDtpzeUKAcb9sYthSFL3YR74cdFgF5mW8yKxv2W2CWuZDFR2dUpE5PF9kbrVXNZ/*))") - addr_a = self.nodes[0].deriveaddresses(multi_a, 0)[0] - addr_b = self.nodes[0].deriveaddresses(multi_b, 0)[0] - txid_a = self.nodes[0].sendtoaddress(addr_a, 0.01) - txid_b = self.nodes[0].sendtoaddress(addr_b, 0.01) - self.generate(self.nodes[0], 1, sync_fun=self.no_op) - # Now import the descriptors, make sure we can identify on which descriptor each coin was received. - self.nodes[0].createwallet(wallet_name="wo", descriptors=True, disable_private_keys=True) - wo_wallet = self.nodes[0].get_wallet_rpc("wo") - wo_wallet.importdescriptors([ - { - "desc": multi_a, - "active": False, - "timestamp": "now", - }, - { - "desc": multi_b, - "active": False, - "timestamp": "now", - }, - ]) - coins = wo_wallet.listunspent(minconf=0) - assert_equal(len(coins), 2) - coin_a = next(c for c in coins if c["txid"] == txid_a) - assert_equal(coin_a["parent_descs"][0], multi_a) - coin_b = next(c for c in coins if c["txid"] == txid_b) - assert_equal(coin_b["parent_descs"][0], multi_b) - self.nodes[0].unloadwallet("wo") + if self.options.descriptors: + self.log.info("Testing 'listunspent' outputs the parent descriptor(s) of coins") + # Create two multisig descriptors, and send a UTxO each. + multi_a = descsum_create("wsh(multi(1,tpubD6NzVbkrYhZ4YBNjUo96Jxd1u4XKWgnoc7LsA1jz3Yc2NiDbhtfBhaBtemB73n9V5vtJHwU6FVXwggTbeoJWQ1rzdz8ysDuQkpnaHyvnvzR/*,tpubD6NzVbkrYhZ4YHdDGMAYGaWxMSC1B6tPRTHuU5t3BcfcS3nrF523iFm5waFd1pP3ZvJt4Jr8XmCmsTBNx5suhcSgtzpGjGMASR3tau1hJz4/*))") + multi_b = descsum_create("wsh(multi(1,tpubD6NzVbkrYhZ4YHdDGMAYGaWxMSC1B6tPRTHuU5t3BcfcS3nrF523iFm5waFd1pP3ZvJt4Jr8XmCmsTBNx5suhcSgtzpGjGMASR3tau1hJz4/*,tpubD6NzVbkrYhZ4Y2RLiuEzNQkntjmsLpPYDm3LTRBYynUQtDtpzeUKAcb9sYthSFL3YR74cdFgF5mW8yKxv2W2CWuZDFR2dUpE5PF9kbrVXNZ/*))") + addr_a = self.nodes[0].deriveaddresses(multi_a, 0)[0] + addr_b = self.nodes[0].deriveaddresses(multi_b, 0)[0] + txid_a = self.nodes[0].sendtoaddress(addr_a, 0.01) + txid_b = self.nodes[0].sendtoaddress(addr_b, 0.01) + self.generate(self.nodes[0], 1, sync_fun=self.no_op) + # Now import the descriptors, make sure we can identify on which descriptor each coin was received. + self.nodes[0].createwallet(wallet_name="wo", descriptors=True, disable_private_keys=True) + wo_wallet = self.nodes[0].get_wallet_rpc("wo") + wo_wallet.importdescriptors([ + { + "desc": multi_a, + "active": False, + "timestamp": "now", + }, + { + "desc": multi_b, + "active": False, + "timestamp": "now", + }, + ]) + coins = wo_wallet.listunspent(minconf=0) + assert_equal(len(coins), 2) + coin_a = next(c for c in coins if c["txid"] == txid_a) + assert_equal(coin_a["parent_descs"][0], multi_a) + coin_b = next(c for c in coins if c["txid"] == txid_b) + assert_equal(coin_b["parent_descs"][0], multi_b) + self.nodes[0].unloadwallet("wo") if __name__ == '__main__': diff --git a/test/functional/wallet_listsinceblock.py b/test/functional/wallet_listsinceblock.py index 204bd67fb1..f259449bef 100755 --- a/test/functional/wallet_listsinceblock.py +++ b/test/functional/wallet_listsinceblock.py @@ -42,7 +42,8 @@ class ListSinceBlockTest(BitcoinTestFramework): self.test_double_send() self.double_spends_filtered() self.test_targetconfirmations() - self.test_desc() + if self.options.descriptors: + self.test_desc() self.test_send_to_self() def test_no_blockhash(self): |