0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-03 09:56:38 -05: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:
    ACK 887d85e43d
  kristapsk:
    ACK 887d85e43d

Tree-SHA512: 05b443ae14138769dc3c87a0178f21db2698fa5bcbeaa953c50ed0c9cf5dcd1effcf4afd09551ca9f4ce73898a7882caaf4c57078767beb6a6a65eb3a662726d
This commit is contained in:
MacroFake 2022-11-09 15:34:09 +01:00
commit 9dce30194b
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -62,6 +62,11 @@ class WalletDescriptorTest(BitcoinTestFramework):
assert addr_info['desc'].startswith('wpkh(')
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
addr = self.nodes[0].getrawchangeaddress("legacy")
addr_info = self.nodes[0].getaddressinfo(addr)
@ -78,6 +83,11 @@ class WalletDescriptorTest(BitcoinTestFramework):
assert addr_info['desc'].startswith('wpkh(')
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
self.nodes[0].createwallet(wallet_name="desc2", descriptors=True)
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),
('p2sh-segwit', False, 'sh(wpkh(', '49\'/1\'/0\'', -14),
('bech32', False, 'wpkh(', '84\'/1\'/0\'', -13),
('bech32m', False, 'tr(', '86\'/1\'/0\'', -13),
('legacy', True, 'pkh(', '44\'/1\'/0\'', -13),
('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:
int_str = 'internal' if internal else 'external'