diff --git a/bitcoin/core/__init__.py b/bitcoin/core/__init__.py index 272bec5c..9055a6e4 100644 --- a/bitcoin/core/__init__.py +++ b/bitcoin/core/__init__.py @@ -387,9 +387,9 @@ def from_txwitness(cls, txwitness): class CTransaction(ImmutableSerializable): """A transaction""" - __slots__ = ['nVersion', 'vin', 'vout', 'nLockTime', 'wit'] + __slots__ = ['nVersion', 'vin', 'vout', 'nLockTime', 'wit', 'flagbyte'] - def __init__(self, vin=(), vout=(), nLockTime=0, nVersion=1, witness=CTxWitness()): + def __init__(self, vin=(), vout=(), nLockTime=0, nVersion=1, witness=CTxWitness(), flagbyte=0): """Create a new transaction vin and vout are iterables of transaction inputs and outputs @@ -403,6 +403,7 @@ def __init__(self, vin=(), vout=(), nLockTime=0, nVersion=1, witness=CTxWitness( object.__setattr__(self, 'vin', tuple(CTxIn.from_txin(txin) for txin in vin)) object.__setattr__(self, 'vout', tuple(CTxOut.from_txout(txout) for txout in vout)) object.__setattr__(self, 'wit', CTxWitness.from_txwitness(witness)) + object.__setattr__(self, 'flagbyte', flagbyte) @classmethod def stream_deserialize(cls, f): @@ -428,8 +429,19 @@ def stream_deserialize(cls, f): wit = CTxWitness(tuple(0 for dummy in range(len(vin)))) wit = wit.stream_deserialize(f) nLockTime = struct.unpack(b"0 and markerbyte ==0 and flagbyte!=1): + vout = VectorSerializer.stream_deserialize(CTxOut, f) + wit = CTxWitness(tuple(0 for dummy in range(len(vin)))) + wit = wit.stream_deserialize(f) + nLockTime = struct.unpack(b"= 3 n = json_prevout[1] if n == -1: n = 0xffffffff