[test] PSBT RPC: check that bip32_derivs are present by default
This commit is contained in:
parent
29a21c9061
commit
5bad7921d0
1 changed files with 14 additions and 4 deletions
|
@ -192,12 +192,20 @@ class PSBTTest(BitcoinTestFramework):
|
||||||
psbt_orig = self.nodes[0].createpsbt([{"txid":txid1, "vout":vout1}, {"txid":txid2, "vout":vout2}], {self.nodes[0].getnewaddress():25.999})
|
psbt_orig = self.nodes[0].createpsbt([{"txid":txid1, "vout":vout1}, {"txid":txid2, "vout":vout2}], {self.nodes[0].getnewaddress():25.999})
|
||||||
|
|
||||||
# Update psbts, should only have data for one input and not the other
|
# Update psbts, should only have data for one input and not the other
|
||||||
psbt1 = self.nodes[1].walletprocesspsbt(psbt_orig)['psbt']
|
psbt1 = self.nodes[1].walletprocesspsbt(psbt_orig, False, "ALL")['psbt']
|
||||||
psbt1_decoded = self.nodes[0].decodepsbt(psbt1)
|
psbt1_decoded = self.nodes[0].decodepsbt(psbt1)
|
||||||
assert psbt1_decoded['inputs'][0] and not psbt1_decoded['inputs'][1]
|
assert psbt1_decoded['inputs'][0] and not psbt1_decoded['inputs'][1]
|
||||||
psbt2 = self.nodes[2].walletprocesspsbt(psbt_orig)['psbt']
|
# Check that BIP32 path was added
|
||||||
|
assert "bip32_derivs" in psbt1_decoded['inputs'][0]
|
||||||
|
psbt2 = self.nodes[2].walletprocesspsbt(psbt_orig, False, "ALL", False)['psbt']
|
||||||
psbt2_decoded = self.nodes[0].decodepsbt(psbt2)
|
psbt2_decoded = self.nodes[0].decodepsbt(psbt2)
|
||||||
assert not psbt2_decoded['inputs'][0] and psbt2_decoded['inputs'][1]
|
assert not psbt2_decoded['inputs'][0] and psbt2_decoded['inputs'][1]
|
||||||
|
# Check that BIP32 paths were not added
|
||||||
|
assert "bip32_derivs" not in psbt2_decoded['inputs'][1]
|
||||||
|
|
||||||
|
# Sign PSBTs (workaround issue #18039)
|
||||||
|
psbt1 = self.nodes[1].walletprocesspsbt(psbt_orig)['psbt']
|
||||||
|
psbt2 = self.nodes[2].walletprocesspsbt(psbt_orig)['psbt']
|
||||||
|
|
||||||
# Combine, finalize, and send the psbts
|
# Combine, finalize, and send the psbts
|
||||||
combined = self.nodes[0].combinepsbt([psbt1, psbt2])
|
combined = self.nodes[0].combinepsbt([psbt1, psbt2])
|
||||||
|
@ -230,16 +238,18 @@ class PSBTTest(BitcoinTestFramework):
|
||||||
# Same construction without optional arguments
|
# Same construction without optional arguments
|
||||||
psbtx_info = self.nodes[0].walletcreatefundedpsbt([{"txid":unspent["txid"], "vout":unspent["vout"]}], [{self.nodes[2].getnewaddress():unspent["amount"]+1}])
|
psbtx_info = self.nodes[0].walletcreatefundedpsbt([{"txid":unspent["txid"], "vout":unspent["vout"]}], [{self.nodes[2].getnewaddress():unspent["amount"]+1}])
|
||||||
decoded_psbt = self.nodes[0].decodepsbt(psbtx_info["psbt"])
|
decoded_psbt = self.nodes[0].decodepsbt(psbtx_info["psbt"])
|
||||||
for tx_in in decoded_psbt["tx"]["vin"]:
|
for tx_in, psbt_in in zip(decoded_psbt["tx"]["vin"], decoded_psbt["inputs"]):
|
||||||
assert_equal(tx_in["sequence"], MAX_BIP125_RBF_SEQUENCE)
|
assert_equal(tx_in["sequence"], MAX_BIP125_RBF_SEQUENCE)
|
||||||
|
assert "bip32_derivs" in psbt_in
|
||||||
assert_equal(decoded_psbt["tx"]["locktime"], 0)
|
assert_equal(decoded_psbt["tx"]["locktime"], 0)
|
||||||
|
|
||||||
# Same construction without optional arguments, for a node with -walletrbf=0
|
# Same construction without optional arguments, for a node with -walletrbf=0
|
||||||
unspent1 = self.nodes[1].listunspent()[0]
|
unspent1 = self.nodes[1].listunspent()[0]
|
||||||
psbtx_info = self.nodes[1].walletcreatefundedpsbt([{"txid":unspent1["txid"], "vout":unspent1["vout"]}], [{self.nodes[2].getnewaddress():unspent1["amount"]+1}], block_height)
|
psbtx_info = self.nodes[1].walletcreatefundedpsbt([{"txid":unspent1["txid"], "vout":unspent1["vout"]}], [{self.nodes[2].getnewaddress():unspent1["amount"]+1}], block_height)
|
||||||
decoded_psbt = self.nodes[1].decodepsbt(psbtx_info["psbt"])
|
decoded_psbt = self.nodes[1].decodepsbt(psbtx_info["psbt"])
|
||||||
for tx_in in decoded_psbt["tx"]["vin"]:
|
for tx_in, psbt_in in zip(decoded_psbt["tx"]["vin"], decoded_psbt["inputs"]):
|
||||||
assert_greater_than(tx_in["sequence"], MAX_BIP125_RBF_SEQUENCE)
|
assert_greater_than(tx_in["sequence"], MAX_BIP125_RBF_SEQUENCE)
|
||||||
|
assert "bip32_derivs" in psbt_in
|
||||||
|
|
||||||
# Make sure change address wallet does not have P2SH innerscript access to results in success
|
# Make sure change address wallet does not have P2SH innerscript access to results in success
|
||||||
# when attempting BnB coin selection
|
# when attempting BnB coin selection
|
||||||
|
|
Loading…
Reference in a new issue