Skip to content

Commit 1ece9a3

Browse files
committed
psbt, test: Check for taproot fields in taproot psbt test
1 parent 496a1bb commit 1ece9a3

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

test/functional/wallet_taproot.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,21 @@ def do_test_psbt(self, comment, pattern, privmap, treefn, keys_pay, keys_change)
301301
test_balance = int(self.psbt_online.getbalance() * 100000000)
302302
ret_amnt = random.randrange(100000, test_balance)
303303
# Increase fee_rate to compensate for the wallet's inability to estimate fees for script path spends.
304-
psbt = self.psbt_online.walletcreatefundedpsbt([], [{self.boring.getnewaddress(): Decimal(ret_amnt) / 100000000}], None, {"subtractFeeFromOutputs":[0], "fee_rate": 200})['psbt']
305-
res = self.psbt_offline.walletprocesspsbt(psbt)
306-
assert(res['complete'])
304+
psbt = self.psbt_online.walletcreatefundedpsbt([], [{self.boring.getnewaddress(): Decimal(ret_amnt) / 100000000}], None, {"subtractFeeFromOutputs":[0], "fee_rate": 200, "change_type": "bech32m"})['psbt']
305+
res = self.psbt_offline.walletprocesspsbt(psbt=psbt, finalize=False)
306+
307+
decoded = self.psbt_offline.decodepsbt(res["psbt"])
308+
if pattern.startswith("tr("):
309+
for psbtin in decoded["inputs"]:
310+
assert "non_witness_utxo" not in psbtin
311+
assert "witness_utxo" in psbtin
312+
assert "taproot_internal_key" in psbtin
313+
assert "taproot_bip32_derivs" in psbtin
314+
assert "taproot_key_path_sig" in psbtin or "taproot_script_path_sigs" in psbtin
315+
if "taproot_script_path_sigs" in psbtin:
316+
assert "taproot_merkle_root" in psbtin
317+
assert "taproot_scripts" in psbtin
318+
307319
rawtx = self.nodes[0].finalizepsbt(res['psbt'])['hex']
308320
txid = self.nodes[0].sendrawtransaction(rawtx)
309321
self.generatetoaddress(self.nodes[0], 1, self.boring.getnewaddress(), sync_fun=self.no_op)

0 commit comments

Comments
 (0)