mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 08:13:52 +02:00
Add psbt_version to PSBT RPCs and default to v2
walletcreatefundedpsbt, createpsbt, converttopsbt, and psbtbumpfee take a psbt_version argument to set the version of the PSBT that they produce. The default psbt_version is 2.
This commit is contained in:
@@ -395,10 +395,10 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
assert res["complete"]
|
||||
res = self.test_send(from_wallet=w0, to_wallet=w1, amount=1, add_to_wallet=False, change_address=change_address, change_position=0)
|
||||
assert res["complete"]
|
||||
assert_equal(self.nodes[0].decodepsbt(res["psbt"])["tx"]["vout"][0]["scriptPubKey"]["address"], change_address)
|
||||
assert_equal(self.nodes[0].decodepsbt(res["psbt"])["outputs"][0]["script"]["address"], change_address)
|
||||
res = self.test_send(from_wallet=w0, to_wallet=w1, amount=1, add_to_wallet=False, change_type="legacy", change_position=0)
|
||||
assert res["complete"]
|
||||
change_address = self.nodes[0].decodepsbt(res["psbt"])["tx"]["vout"][0]["scriptPubKey"]["address"]
|
||||
change_address = self.nodes[0].decodepsbt(res["psbt"])["outputs"][0]["script"]["address"]
|
||||
assert change_address[0] in ("m", "n")
|
||||
|
||||
self.log.info("Set lock time...")
|
||||
@@ -498,11 +498,9 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
assert signed["complete"]
|
||||
|
||||
dec = self.nodes[0].decodepsbt(signed["psbt"])
|
||||
for i, txin in enumerate(dec["tx"]["vin"]):
|
||||
if txin["txid"] == ext_utxo["txid"] and txin["vout"] == ext_utxo["vout"]:
|
||||
input_idx = i
|
||||
for psbt_in in dec["inputs"]:
|
||||
if psbt_in["previous_txid"] == ext_utxo["txid"] and psbt_in["previous_vout"] == ext_utxo["vout"]:
|
||||
break
|
||||
psbt_in = dec["inputs"][input_idx]
|
||||
scriptsig_hex = psbt_in["final_scriptSig"]["hex"] if "final_scriptSig" in psbt_in else ""
|
||||
witness_stack_hex = psbt_in["final_scriptwitness"] if "final_scriptwitness" in psbt_in else None
|
||||
input_weight = calculate_input_weight(scriptsig_hex, witness_stack_hex)
|
||||
|
||||
Reference in New Issue
Block a user