mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
test: check that combining PSBTs with different txs fails
This commit is contained in:
parent
2a428c7989
commit
4e616d20c9
@ -820,6 +820,16 @@ class PSBTTest(BitcoinTestFramework):
|
||||
assert hash.hex() in res_input[preimage_key]
|
||||
assert_equal(res_input[preimage_key][hash.hex()], preimage.hex())
|
||||
|
||||
self.log.info("Test that combining PSBTs with different transactions fails")
|
||||
tx = CTransaction()
|
||||
tx.vin = [CTxIn(outpoint=COutPoint(hash=int('aa' * 32, 16), n=0), scriptSig=b"")]
|
||||
tx.vout = [CTxOut(nValue=0, scriptPubKey=b"")]
|
||||
psbt1 = PSBT(g=PSBTMap({PSBT_GLOBAL_UNSIGNED_TX: tx.serialize()}), i=[PSBTMap()], o=[PSBTMap()]).to_base64()
|
||||
tx.vout[0].nValue += 1 # slightly modify tx
|
||||
psbt2 = PSBT(g=PSBTMap({PSBT_GLOBAL_UNSIGNED_TX: tx.serialize()}), i=[PSBTMap()], o=[PSBTMap()]).to_base64()
|
||||
assert_raises_rpc_error(-8, "PSBTs not compatible (different transactions)", self.nodes[0].combinepsbt, [psbt1, psbt2])
|
||||
assert_equal(self.nodes[0].combinepsbt([psbt1, psbt1]), psbt1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
PSBTTest().main()
|
||||
|
Loading…
Reference in New Issue
Block a user