@@ -20,7 +20,7 @@ sys.path.insert(0, PATH_BASE_TEST_FUNCTIONAL)
2020
2121from test_framework .blocktools import get_witness_script , script_BIP34_coinbase_height # noqa: E402
2222from test_framework .messages import CBlock , CBlockHeader , COutPoint , CTransaction , CTxIn , CTxInWitness , CTxOut , from_binary , from_hex , ser_string , ser_uint256 , tx_from_hex # noqa: E402
23- from test_framework .psbt import PSBT , PSBTMap # noqa: E402
23+ from test_framework .psbt import PSBT , PSBTMap , PSBT_GLOBAL_UNSIGNED_TX , PSBT_IN_FINAL_SCRIPTSIG , PSBT_IN_FINAL_SCRIPTWITNESS , PSBT_IN_NON_WITNESS_UTXO , PSBT_IN_SIGHASH_TYPE # noqa: E402
2424from test_framework .script import CScriptOp # noqa: E402
2525
2626logging .basicConfig (
@@ -74,11 +74,11 @@ def signet_txs(block, challenge):
7474
7575def do_createpsbt (block , signme , spendme ):
7676 psbt = PSBT ()
77- psbt .g = PSBTMap ( {0 : signme .serialize (),
77+ psbt .g = PSBTMap ( {PSBT_GLOBAL_UNSIGNED_TX : signme .serialize (),
7878 PSBT_SIGNET_BLOCK : block .serialize ()
7979 } )
80- psbt .i = [ PSBTMap ( {0 : spendme .serialize (),
81- 3 : bytes ([1 ,0 ,0 ,0 ])})
80+ psbt .i = [ PSBTMap ( {PSBT_IN_NON_WITNESS_UTXO : spendme .serialize (),
81+ PSBT_IN_SIGHASH_TYPE : bytes ([1 ,0 ,0 ,0 ])})
8282 ]
8383 psbt .o = [ PSBTMap () ]
8484 return psbt .to_base64 ()
@@ -90,8 +90,8 @@ def do_decode_psbt(b64psbt):
9090 assert len (psbt .tx .vout ) == 1
9191 assert PSBT_SIGNET_BLOCK in psbt .g .map
9292
93- scriptSig = psbt .i [0 ].map .get (7 , b"" )
94- scriptWitness = psbt .i [0 ].map .get (8 , b"\x00 " )
93+ scriptSig = psbt .i [0 ].map .get (PSBT_IN_FINAL_SCRIPTSIG , b"" )
94+ scriptWitness = psbt .i [0 ].map .get (PSBT_IN_FINAL_SCRIPTWITNESS , b"\x00 " )
9595
9696 return from_binary (CBlock , psbt .g .map [PSBT_SIGNET_BLOCK ]), ser_string (scriptSig ) + scriptWitness
9797
0 commit comments