@@ -20,7 +20,7 @@ sys.path.insert(0, PATH_BASE_TEST_FUNCTIONAL)
20
20
21
21
from test_framework .blocktools import get_witness_script , script_BIP34_coinbase_height # noqa: E402
22
22
from 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
24
24
from test_framework .script import CScriptOp # noqa: E402
25
25
26
26
logging .basicConfig (
@@ -74,11 +74,11 @@ def signet_txs(block, challenge):
74
74
75
75
def do_createpsbt (block , signme , spendme ):
76
76
psbt = PSBT ()
77
- psbt .g = PSBTMap ( {0 : signme .serialize (),
77
+ psbt .g = PSBTMap ( {PSBT_GLOBAL_UNSIGNED_TX : signme .serialize (),
78
78
PSBT_SIGNET_BLOCK : block .serialize ()
79
79
} )
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 ])})
82
82
]
83
83
psbt .o = [ PSBTMap () ]
84
84
return psbt .to_base64 ()
@@ -90,8 +90,8 @@ def do_decode_psbt(b64psbt):
90
90
assert len (psbt .tx .vout ) == 1
91
91
assert PSBT_SIGNET_BLOCK in psbt .g .map
92
92
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 " )
95
95
96
96
return from_binary (CBlock , psbt .g .map [PSBT_SIGNET_BLOCK ]), ser_string (scriptSig ) + scriptWitness
97
97
0 commit comments