mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-09 21:57:20 +01:00
Merge bitcoin/bitcoin#26472: test: add missing bech32m / BIP86 test-cases to wallet_descriptor.py
887d85e43d
test: add missing bech32m / BIP86 test-cases to wallet_descriptor.py (Sebastian Falbesoner) Pull request description: This small PR adds missing "bech32m" address type / BIP86 checks w.r.t. to the `getnewaddress`/`getrawchangeaddress` RPC and descriptor export functionality to the functional test `wallet_descriptor.py`. ACKs for top commit: shaavan: ACK887d85e43d
kristapsk: ACK887d85e43d
Tree-SHA512: 05b443ae14138769dc3c87a0178f21db2698fa5bcbeaa953c50ed0c9cf5dcd1effcf4afd09551ca9f4ce73898a7882caaf4c57078767beb6a6a65eb3a662726d
This commit is contained in:
commit
9dce30194b
1 changed files with 13 additions and 1 deletions
|
@ -62,6 +62,11 @@ class WalletDescriptorTest(BitcoinTestFramework):
|
||||||
assert addr_info['desc'].startswith('wpkh(')
|
assert addr_info['desc'].startswith('wpkh(')
|
||||||
assert_equal(addr_info['hdkeypath'], 'm/84\'/1\'/0\'/0/0')
|
assert_equal(addr_info['hdkeypath'], 'm/84\'/1\'/0\'/0/0')
|
||||||
|
|
||||||
|
addr = self.nodes[0].getnewaddress("", "bech32m")
|
||||||
|
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||||
|
assert addr_info['desc'].startswith('tr(')
|
||||||
|
assert_equal(addr_info['hdkeypath'], 'm/86\'/1\'/0\'/0/0')
|
||||||
|
|
||||||
# Check that getrawchangeaddress works
|
# Check that getrawchangeaddress works
|
||||||
addr = self.nodes[0].getrawchangeaddress("legacy")
|
addr = self.nodes[0].getrawchangeaddress("legacy")
|
||||||
addr_info = self.nodes[0].getaddressinfo(addr)
|
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||||
|
@ -78,6 +83,11 @@ class WalletDescriptorTest(BitcoinTestFramework):
|
||||||
assert addr_info['desc'].startswith('wpkh(')
|
assert addr_info['desc'].startswith('wpkh(')
|
||||||
assert_equal(addr_info['hdkeypath'], 'm/84\'/1\'/0\'/1/0')
|
assert_equal(addr_info['hdkeypath'], 'm/84\'/1\'/0\'/1/0')
|
||||||
|
|
||||||
|
addr = self.nodes[0].getrawchangeaddress("bech32m")
|
||||||
|
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||||
|
assert addr_info['desc'].startswith('tr(')
|
||||||
|
assert_equal(addr_info['hdkeypath'], 'm/86\'/1\'/0\'/1/0')
|
||||||
|
|
||||||
# Make a wallet to receive coins at
|
# Make a wallet to receive coins at
|
||||||
self.nodes[0].createwallet(wallet_name="desc2", descriptors=True)
|
self.nodes[0].createwallet(wallet_name="desc2", descriptors=True)
|
||||||
recv_wrpc = self.nodes[0].get_wallet_rpc("desc2")
|
recv_wrpc = self.nodes[0].get_wallet_rpc("desc2")
|
||||||
|
@ -161,9 +171,11 @@ class WalletDescriptorTest(BitcoinTestFramework):
|
||||||
addr_types = [('legacy', False, 'pkh(', '44\'/1\'/0\'', -13),
|
addr_types = [('legacy', False, 'pkh(', '44\'/1\'/0\'', -13),
|
||||||
('p2sh-segwit', False, 'sh(wpkh(', '49\'/1\'/0\'', -14),
|
('p2sh-segwit', False, 'sh(wpkh(', '49\'/1\'/0\'', -14),
|
||||||
('bech32', False, 'wpkh(', '84\'/1\'/0\'', -13),
|
('bech32', False, 'wpkh(', '84\'/1\'/0\'', -13),
|
||||||
|
('bech32m', False, 'tr(', '86\'/1\'/0\'', -13),
|
||||||
('legacy', True, 'pkh(', '44\'/1\'/0\'', -13),
|
('legacy', True, 'pkh(', '44\'/1\'/0\'', -13),
|
||||||
('p2sh-segwit', True, 'sh(wpkh(', '49\'/1\'/0\'', -14),
|
('p2sh-segwit', True, 'sh(wpkh(', '49\'/1\'/0\'', -14),
|
||||||
('bech32', True, 'wpkh(', '84\'/1\'/0\'', -13)]
|
('bech32', True, 'wpkh(', '84\'/1\'/0\'', -13),
|
||||||
|
('bech32m', True, 'tr(', '86\'/1\'/0\'', -13)]
|
||||||
|
|
||||||
for addr_type, internal, desc_prefix, deriv_path, int_idx in addr_types:
|
for addr_type, internal, desc_prefix, deriv_path, int_idx in addr_types:
|
||||||
int_str = 'internal' if internal else 'external'
|
int_str = 'internal' if internal else 'external'
|
||||||
|
|
Loading…
Add table
Reference in a new issue