mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 03:03:22 -03:00
test: add e2e tests for rawnode() and rawleaf()
This commit is contained in:
parent
a9a9e78c3f
commit
133b30019c
1 changed files with 20 additions and 2 deletions
|
@ -55,6 +55,14 @@ DESCS = [
|
|||
f"tr(4d54bb9928a0683b7e383de72943b214b0716f58aa54c7ba6bcea2328bc9c768,{{{{{P2WSH_MINISCRIPTS[0]},{P2WSH_MINISCRIPTS[1]}}},{P2WSH_MINISCRIPTS[2].replace('multi', 'multi_a')}}})",
|
||||
# A Taproot with all above scripts in its tree.
|
||||
f"tr(4d54bb9928a0683b7e383de72943b214b0716f58aa54c7ba6bcea2328bc9c768,{{{{{P2WSH_MINISCRIPTS[0]},{P2WSH_MINISCRIPTS[1]}}},{{{P2WSH_MINISCRIPTS[2].replace('multi', 'multi_a')},{P2WSH_MINISCRIPTS[3]}}}}})",
|
||||
# A Taproot with rawnode as root in its tree
|
||||
f"tr({TPUBS[0]}/*,rawnode(8a62dc0a100c4156cc2a4b7c2a97747ce0dfe90562673fd662678aaae93121fb))",
|
||||
# A Taproot with rawnode and multipath descriptor
|
||||
f"tr({TPUBS[0]}/*,{{rawnode(8a62dc0a100c4156cc2a4b7c2a97747ce0dfe90562673fd662678aaae93121fb),pk({TPUBS[0]}/<1;2>/*)}})",
|
||||
# A Taproot with rawnode as branch root in its tree
|
||||
f"tr(4d54bb9928a0683b7e383de72943b214b0716f58aa54c7ba6bcea2328bc9c768,{{{P2WSH_MINISCRIPTS[0]},rawnode(8a62dc0a100c4156cc2a4b7c2a97747ce0dfe90562673fd662678aaae93121fb)}})",
|
||||
# A Taproot with rawleaf in its tree
|
||||
f"tr({TPUBS[0]}/*,rawleaf(aa2061e33e9dbfefc45f6a194187684d278f789fd4d5e207a357e79971b6519a8b128821{PUBKEYS[0]}ac))"
|
||||
]
|
||||
|
||||
DESCS_PRIV = [
|
||||
|
@ -199,6 +207,14 @@ DESCS_PRIV = [
|
|||
"sigs_count": 2,
|
||||
"stack_size": 8,
|
||||
},
|
||||
# Taproot with a rawnode in the tree
|
||||
{
|
||||
"desc": f"tr({TPUBS[0]}/*,{{pk({TPRVS[0]}/*),rawnode(8a62dc0a100c4156cc2a4b7c2a97747ce0dfe90562673fd662678aaae93121fb)}})",
|
||||
"sequence": None,
|
||||
"locktime": None,
|
||||
"sigs_count": 1,
|
||||
"stack_size": 3,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
@ -231,13 +247,15 @@ class WalletMiniscriptTest(BitcoinTestFramework):
|
|||
|
||||
self.log.info("Testing we derive new addresses for it")
|
||||
addr_type = "bech32m" if desc.startswith("tr(") else "bech32"
|
||||
derived = [self.funder.deriveaddresses(desc, 0), self.funder.deriveaddresses(desc, 1)]
|
||||
is_multipath = desc.count("<1;2>") > 0
|
||||
assert_equal(
|
||||
self.ms_wo_wallet.getnewaddress(address_type=addr_type),
|
||||
self.funder.deriveaddresses(desc, 0)[0],
|
||||
derived[0][0][0] if is_multipath else derived[0][0],
|
||||
)
|
||||
assert_equal(
|
||||
self.ms_wo_wallet.getnewaddress(address_type=addr_type),
|
||||
self.funder.deriveaddresses(desc, 1)[1],
|
||||
derived[1][0][1] if is_multipath else derived[1][1],
|
||||
)
|
||||
|
||||
self.log.info("Testing we detect funds sent to one of them")
|
||||
|
|
Loading…
Add table
Reference in a new issue