Skip to content

Commit f7a173b

Browse files
committed
test: rpc_createmultisig, decouple 'test_sortedmulti_descriptors_bip67'
Move-only commit. No behavior change.
1 parent 4f33dbd commit f7a173b

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

test/functional/rpc_createmultisig.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,7 @@ def run_test(self):
6363
self.do_multisig(nkeys, nsigs, output_type, wallet_multi)
6464

6565
self.test_mixing_uncompressed_and_compressed_keys(node0, wallet_multi)
66-
67-
self.log.info('Testing sortedmulti descriptors with BIP 67 test vectors')
68-
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data/rpc_bip67.json'), encoding='utf-8') as f:
69-
vectors = json.load(f)
70-
71-
for t in vectors:
72-
key_str = ','.join(t['keys'])
73-
desc = descsum_create('sh(sortedmulti(2,{}))'.format(key_str))
74-
assert_equal(self.nodes[0].deriveaddresses(desc)[0], t['address'])
75-
sorted_key_str = ','.join(t['sorted_keys'])
76-
sorted_key_desc = descsum_create('sh(multi(2,{}))'.format(sorted_key_str))
77-
assert_equal(self.nodes[0].deriveaddresses(sorted_key_desc)[0], t['address'])
66+
self.test_sortedmulti_descriptors_bip67()
7867

7968
# Check that bech32m is currently not allowed
8069
assert_raises_rpc_error(-5, "createmultisig cannot create bech32m multisig addresses", self.nodes[0].createmultisig, 2, self.pub, "bech32m")
@@ -214,6 +203,18 @@ def test_mixing_uncompressed_and_compressed_keys(self, node, wallet_multi):
214203
assert_equal(legacy_addr, result['address'])
215204
assert_equal(result['warnings'], err_msg)
216205

206+
def test_sortedmulti_descriptors_bip67(self):
207+
self.log.info('Testing sortedmulti descriptors with BIP 67 test vectors')
208+
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data/rpc_bip67.json'), encoding='utf-8') as f:
209+
vectors = json.load(f)
210+
211+
for t in vectors:
212+
key_str = ','.join(t['keys'])
213+
desc = descsum_create('sh(sortedmulti(2,{}))'.format(key_str))
214+
assert_equal(self.nodes[0].deriveaddresses(desc)[0], t['address'])
215+
sorted_key_str = ','.join(t['sorted_keys'])
216+
sorted_key_desc = descsum_create('sh(multi(2,{}))'.format(sorted_key_str))
217+
assert_equal(self.nodes[0].deriveaddresses(sorted_key_desc)[0], t['address'])
217218

218219

219220
if __name__ == '__main__':

0 commit comments

Comments
 (0)