Skip to content

Commit 2557429

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#26037: test: Fix wallet_{basic,listsinceblock}.py for BDB-only wallets
9f3a315 test: Fix `wallet_listsinceblock.py` for BDB-only wallets (Hennadii Stepanov) 1941ce6 test: Fix `wallet_basic.py` for BDB-only wallets (Hennadii Stepanov) Pull request description: Fixes bitcoin/bitcoin#26029. ACKs for top commit: brunoerg: crACK 9f3a315 Tree-SHA512: d31c76e558dedea689ff487644e9f2d2f1df1cc2bb9bb041ede4b272884871167fdb19ccc717394c6ba6af8b8c70e9575b344988e0ce55b241a3a4922d0b7f73
2 parents 37095c7 + 9f3a315 commit 2557429

File tree

2 files changed

+34
-32
lines changed

2 files changed

+34
-32
lines changed

test/functional/wallet_basic.py

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -695,37 +695,38 @@ def run_test(self):
695695
txid_feeReason_four = self.nodes[2].sendmany(dummy='', amounts={address: 5}, verbose=False)
696696
assert_equal(self.nodes[2].gettransaction(txid_feeReason_four)['txid'], txid_feeReason_four)
697697

698-
self.log.info("Testing 'listunspent' outputs the parent descriptor(s) of coins")
699-
# Create two multisig descriptors, and send a UTxO each.
700-
multi_a = descsum_create("wsh(multi(1,tpubD6NzVbkrYhZ4YBNjUo96Jxd1u4XKWgnoc7LsA1jz3Yc2NiDbhtfBhaBtemB73n9V5vtJHwU6FVXwggTbeoJWQ1rzdz8ysDuQkpnaHyvnvzR/*,tpubD6NzVbkrYhZ4YHdDGMAYGaWxMSC1B6tPRTHuU5t3BcfcS3nrF523iFm5waFd1pP3ZvJt4Jr8XmCmsTBNx5suhcSgtzpGjGMASR3tau1hJz4/*))")
701-
multi_b = descsum_create("wsh(multi(1,tpubD6NzVbkrYhZ4YHdDGMAYGaWxMSC1B6tPRTHuU5t3BcfcS3nrF523iFm5waFd1pP3ZvJt4Jr8XmCmsTBNx5suhcSgtzpGjGMASR3tau1hJz4/*,tpubD6NzVbkrYhZ4Y2RLiuEzNQkntjmsLpPYDm3LTRBYynUQtDtpzeUKAcb9sYthSFL3YR74cdFgF5mW8yKxv2W2CWuZDFR2dUpE5PF9kbrVXNZ/*))")
702-
addr_a = self.nodes[0].deriveaddresses(multi_a, 0)[0]
703-
addr_b = self.nodes[0].deriveaddresses(multi_b, 0)[0]
704-
txid_a = self.nodes[0].sendtoaddress(addr_a, 0.01)
705-
txid_b = self.nodes[0].sendtoaddress(addr_b, 0.01)
706-
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
707-
# Now import the descriptors, make sure we can identify on which descriptor each coin was received.
708-
self.nodes[0].createwallet(wallet_name="wo", descriptors=True, disable_private_keys=True)
709-
wo_wallet = self.nodes[0].get_wallet_rpc("wo")
710-
wo_wallet.importdescriptors([
711-
{
712-
"desc": multi_a,
713-
"active": False,
714-
"timestamp": "now",
715-
},
716-
{
717-
"desc": multi_b,
718-
"active": False,
719-
"timestamp": "now",
720-
},
721-
])
722-
coins = wo_wallet.listunspent(minconf=0)
723-
assert_equal(len(coins), 2)
724-
coin_a = next(c for c in coins if c["txid"] == txid_a)
725-
assert_equal(coin_a["parent_descs"][0], multi_a)
726-
coin_b = next(c for c in coins if c["txid"] == txid_b)
727-
assert_equal(coin_b["parent_descs"][0], multi_b)
728-
self.nodes[0].unloadwallet("wo")
698+
if self.options.descriptors:
699+
self.log.info("Testing 'listunspent' outputs the parent descriptor(s) of coins")
700+
# Create two multisig descriptors, and send a UTxO each.
701+
multi_a = descsum_create("wsh(multi(1,tpubD6NzVbkrYhZ4YBNjUo96Jxd1u4XKWgnoc7LsA1jz3Yc2NiDbhtfBhaBtemB73n9V5vtJHwU6FVXwggTbeoJWQ1rzdz8ysDuQkpnaHyvnvzR/*,tpubD6NzVbkrYhZ4YHdDGMAYGaWxMSC1B6tPRTHuU5t3BcfcS3nrF523iFm5waFd1pP3ZvJt4Jr8XmCmsTBNx5suhcSgtzpGjGMASR3tau1hJz4/*))")
702+
multi_b = descsum_create("wsh(multi(1,tpubD6NzVbkrYhZ4YHdDGMAYGaWxMSC1B6tPRTHuU5t3BcfcS3nrF523iFm5waFd1pP3ZvJt4Jr8XmCmsTBNx5suhcSgtzpGjGMASR3tau1hJz4/*,tpubD6NzVbkrYhZ4Y2RLiuEzNQkntjmsLpPYDm3LTRBYynUQtDtpzeUKAcb9sYthSFL3YR74cdFgF5mW8yKxv2W2CWuZDFR2dUpE5PF9kbrVXNZ/*))")
703+
addr_a = self.nodes[0].deriveaddresses(multi_a, 0)[0]
704+
addr_b = self.nodes[0].deriveaddresses(multi_b, 0)[0]
705+
txid_a = self.nodes[0].sendtoaddress(addr_a, 0.01)
706+
txid_b = self.nodes[0].sendtoaddress(addr_b, 0.01)
707+
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
708+
# Now import the descriptors, make sure we can identify on which descriptor each coin was received.
709+
self.nodes[0].createwallet(wallet_name="wo", descriptors=True, disable_private_keys=True)
710+
wo_wallet = self.nodes[0].get_wallet_rpc("wo")
711+
wo_wallet.importdescriptors([
712+
{
713+
"desc": multi_a,
714+
"active": False,
715+
"timestamp": "now",
716+
},
717+
{
718+
"desc": multi_b,
719+
"active": False,
720+
"timestamp": "now",
721+
},
722+
])
723+
coins = wo_wallet.listunspent(minconf=0)
724+
assert_equal(len(coins), 2)
725+
coin_a = next(c for c in coins if c["txid"] == txid_a)
726+
assert_equal(coin_a["parent_descs"][0], multi_a)
727+
coin_b = next(c for c in coins if c["txid"] == txid_b)
728+
assert_equal(coin_b["parent_descs"][0], multi_b)
729+
self.nodes[0].unloadwallet("wo")
729730

730731

731732
if __name__ == '__main__':

test/functional/wallet_listsinceblock.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def run_test(self):
4242
self.test_double_send()
4343
self.double_spends_filtered()
4444
self.test_targetconfirmations()
45-
self.test_desc()
45+
if self.options.descriptors:
46+
self.test_desc()
4647
self.test_send_to_self()
4748

4849
def test_no_blockhash(self):

0 commit comments

Comments
 (0)