support locktime

This commit is contained in:
ThomasV 2016-05-18 11:58:27 +02:00
parent ede1fbdb1f
commit 461cbd357a
1 changed files with 4 additions and 2 deletions

View File

@ -489,6 +489,7 @@ class Transaction:
raise BaseException("cannot initialize transaction", raw) raise BaseException("cannot initialize transaction", raw)
self._inputs = None self._inputs = None
self._outputs = None self._outputs = None
self.locktime = 0
def update(self, raw): def update(self, raw):
self.raw = raw self.raw = raw
@ -693,7 +694,7 @@ class Transaction:
script = self.pay_script(output_type, addr) script = self.pay_script(output_type, addr)
s += var_int(len(script)/2) # script length s += var_int(len(script)/2) # script length
s += script # script s += script # script
s += int_to_hex(0, 4) # lock time s += int_to_hex(self.locktime, 4) # locktime
if for_sig is not None and for_sig != -1: if for_sig is not None and for_sig != -1:
s += int_to_hex(1, 4) # hash type s += int_to_hex(1, 4) # hash type
return s return s
@ -833,7 +834,8 @@ class Transaction:
self.deserialize() self.deserialize()
out = { out = {
'hex': self.raw, 'hex': self.raw,
'complete': self.is_complete() 'complete': self.is_complete(),
'final': self.is_final(),
} }
return out return out