Merge 317ef0368b into merged_master (Bitcoin PR bitcoin/bitcoin#25670)

related to the FIXME in #25625, PSBT python class needs to be reworked
for elements
This commit is contained in:
Byron Hambly 2024-10-21 09:51:56 +02:00
commit 80c47aa8aa
2 changed files with 15 additions and 4 deletions

View file

@ -1328,6 +1328,17 @@ class PSBTTest(BitcoinTestFramework):
# assert hash.hex() in res_input[preimage_key]
# assert_equal(res_input[preimage_key][hash.hex()], preimage.hex())
# ELEMENTS FIXME
# 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()

View file

@ -96,10 +96,10 @@ class PSBTMap:
class PSBT:
"""Class for serializing and deserializing PSBTs"""
def __init__(self):
self.g = PSBTMap()
self.i = []
self.o = []
def __init__(self, *, g=None, i=None, o=None):
self.g = g if g is not None else PSBTMap()
self.i = i if i is not None else []
self.o = o if o is not None else []
self.tx = None
def deserialize(self, f):