Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/mininode.py
Show First 20 Lines • Show All 396 Lines • ▼ Show 20 Lines | class CTransaction(): | ||||
def deserialize(self, f): | def deserialize(self, f): | ||||
self.nVersion = struct.unpack("<i", f.read(4))[0] | self.nVersion = struct.unpack("<i", f.read(4))[0] | ||||
self.vin = deser_vector(f, CTxIn) | self.vin = deser_vector(f, CTxIn) | ||||
self.vout = deser_vector(f, CTxOut) | self.vout = deser_vector(f, CTxOut) | ||||
self.nLockTime = struct.unpack("<I", f.read(4))[0] | self.nLockTime = struct.unpack("<I", f.read(4))[0] | ||||
self.sha256 = None | self.sha256 = None | ||||
self.hash = None | self.hash = None | ||||
def billable_size(self): | |||||
""" | |||||
Returns the size used for billing the against the transaction | |||||
""" | |||||
return len(self.serialize()) | |||||
def serialize(self): | def serialize(self): | ||||
r = b"" | r = b"" | ||||
r += struct.pack("<i", self.nVersion) | r += struct.pack("<i", self.nVersion) | ||||
r += ser_vector(self.vin) | r += ser_vector(self.vin) | ||||
r += ser_vector(self.vout) | r += ser_vector(self.vout) | ||||
r += struct.pack("<I", self.nLockTime) | r += struct.pack("<I", self.nLockTime) | ||||
return r | return r | ||||
▲ Show 20 Lines • Show All 1,355 Lines • Show Last 20 Lines |