achow101
commented at 11:01 AM on March 7, 2022:
member
Sometimes the multi_a and sortedmulti_a descriptors will produce some of the same addresses in the tests. This causes the wallets to start generating addresses at a different index as they detect that one of the addresses is used. This subsequently causes a test failure.
To avoid this problem, use descriptors that will produce unique addresses by putting one of the multi_a in a different branch.
tests: Ensure sorted/multi_a descriptors always generate different addrs
Sometimes the multi_a and sortedmulti_a descriptors will produce some of
the same addresses in the tests. This causes the wallets to start
generating addresses at a different index as they detect that one of
the addresses is used. This subsequently causes a test failure.
To avoid this problem, use descriptors that will produce unique
addresses by putting one of the multi_a in a different branch.
db27ac9354
achow101 force-pushed on Mar 7, 2022
theStack
commented at 11:37 AM on March 7, 2022:
contributor
Concept ACK
fanquake added the label Tests on Mar 7, 2022
theStack approved
theStack
commented at 1:19 PM on March 7, 2022:
contributor
On master, generating the same addresses causing the problem described in the OP can be reproduced with the following patch (determined in the course of investigating the CI failure #24486 (comment), unrelated to the linked PR):
diff --git a/test/functional/wallet_taproot.py b/test/functional/wallet_taproot.py
index 54c992852..5443f815a 100755
--- a/test/functional/wallet_taproot.py
+++ b/test/functional/wallet_taproot.py
@@ -333,6 +333,10 @@ class WalletTaprootTest(BitcoinTestFramework):
def do_test(self, comment, pattern, privmap, treefn):
nkeys = len(privmap)
keys = self.rand_keys(nkeys * 4)
+
+ if nkeys == 2: # these keys will result in same addresses for sorted_a/multi_a descriptors
+ keys = [KEYS[i] for i in [11, 6, 0, 1, 2, 3, 4, 5]]
+
self.do_test_addr(comment, pattern, privmap, treefn, keys[0:nkeys])
self.do_test_sendtoaddress(comment, pattern, privmap, treefn, keys[0:nkeys], keys[nkeys:2*nkeys])
self.do_test_psbt(comment, pattern, privmap, treefn, keys[2*nkeys:3*nkeys], keys[3*nkeys:4*nkeys])
.....
2022-03-07T13:12:18.658000Z TestFramework (INFO): Testing tr(H,multi_a(1,XPUB,XPRV)) address derivation
2022-03-07T13:12:18.914000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
File "/home/honey/bitcoin/test/functional/test_framework/test_framework.py", line 132, in main
self.run_test()
File "./test/functional/wallet_taproot.py", line 435, in run_test
self.do_test(
File "./test/functional/wallet_taproot.py", line 340, in do_test
self.do_test_addr(comment, pattern, privmap, treefn, keys[0:nkeys])
File "./test/functional/wallet_taproot.py", line 251, in do_test_addr
assert_equal(addr_g, addr_r)
File "/home/honey/bitcoin/test/functional/test_framework/util.py", line 51, in assert_equal
raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
AssertionError: not(bcrt1px3pnh5n8npeqr3cv0aq6dvqpcsujrgksfd6hup8dpa62z3m9jf9s3sk3ve == bcrt1pn2xq83tt55vfsxtwhkx96sanchkjzwg6yqxuewvn6emkfyqnyp0qe5cteg)
2022-03-07T13:12:18.987000Z TestFramework (INFO): Stopping nodes
.....
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:53 UTC