|
|
@ -20,7 +20,7 @@ sys.path.insert(0, PATH_BASE_TEST_FUNCTIONAL)
|
|
|
|
|
|
|
|
|
|
|
|
from test_framework.blocktools import get_witness_script, script_BIP34_coinbase_height # noqa: E402
|
|
|
|
from test_framework.blocktools import get_witness_script, script_BIP34_coinbase_height # noqa: E402
|
|
|
|
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
|
|
|
|
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
|
|
|
|
from test_framework.psbt import PSBT, PSBTMap # noqa: E402
|
|
|
|
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
|
|
|
|
from test_framework.script import CScriptOp # noqa: E402
|
|
|
|
from test_framework.script import CScriptOp # noqa: E402
|
|
|
|
|
|
|
|
|
|
|
|
logging.basicConfig(
|
|
|
|
logging.basicConfig(
|
|
|
@ -74,11 +74,11 @@ def signet_txs(block, challenge):
|
|
|
|
|
|
|
|
|
|
|
|
def do_createpsbt(block, signme, spendme):
|
|
|
|
def do_createpsbt(block, signme, spendme):
|
|
|
|
psbt = PSBT()
|
|
|
|
psbt = PSBT()
|
|
|
|
psbt.g = PSBTMap( {0: signme.serialize(),
|
|
|
|
psbt.g = PSBTMap( {PSBT_GLOBAL_UNSIGNED_TX: signme.serialize(),
|
|
|
|
PSBT_SIGNET_BLOCK: block.serialize()
|
|
|
|
PSBT_SIGNET_BLOCK: block.serialize()
|
|
|
|
} )
|
|
|
|
} )
|
|
|
|
psbt.i = [ PSBTMap( {0: spendme.serialize(),
|
|
|
|
psbt.i = [ PSBTMap( {PSBT_IN_NON_WITNESS_UTXO: spendme.serialize(),
|
|
|
|
3: bytes([1,0,0,0])})
|
|
|
|
PSBT_IN_SIGHASH_TYPE: bytes([1,0,0,0])})
|
|
|
|
]
|
|
|
|
]
|
|
|
|
psbt.o = [ PSBTMap() ]
|
|
|
|
psbt.o = [ PSBTMap() ]
|
|
|
|
return psbt.to_base64()
|
|
|
|
return psbt.to_base64()
|
|
|
@ -90,8 +90,8 @@ def do_decode_psbt(b64psbt):
|
|
|
|
assert len(psbt.tx.vout) == 1
|
|
|
|
assert len(psbt.tx.vout) == 1
|
|
|
|
assert PSBT_SIGNET_BLOCK in psbt.g.map
|
|
|
|
assert PSBT_SIGNET_BLOCK in psbt.g.map
|
|
|
|
|
|
|
|
|
|
|
|
scriptSig = psbt.i[0].map.get(7, b"")
|
|
|
|
scriptSig = psbt.i[0].map.get(PSBT_IN_FINAL_SCRIPTSIG, b"")
|
|
|
|
scriptWitness = psbt.i[0].map.get(8, b"\x00")
|
|
|
|
scriptWitness = psbt.i[0].map.get(PSBT_IN_FINAL_SCRIPTWITNESS, b"\x00")
|
|
|
|
|
|
|
|
|
|
|
|
return from_binary(CBlock, psbt.g.map[PSBT_SIGNET_BLOCK]), ser_string(scriptSig) + scriptWitness
|
|
|
|
return from_binary(CBlock, psbt.g.map[PSBT_SIGNET_BLOCK]), ser_string(scriptSig) + scriptWitness
|
|
|
|
|
|
|
|
|
|
|
|