electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit d4e8f4beb630d46cdc196df11dcf57540f0bec71
parent 1ee70f798e58254e00e4af40c806ef0e1d053018
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 23 May 2017 15:07:20 +0200

Set sequence to MAXINT-1 to fix locktime (per bauerj)

Diffstat:
Mlib/transaction.py | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/transaction.py b/lib/transaction.py @@ -686,11 +686,11 @@ class Transaction: # Script length, script, sequence s += var_int(len(script)/2) s += script - s += int_to_hex(txin.get('sequence', 0xffffffff), 4) + s += int_to_hex(txin.get('sequence', 0xffffffff - 1), 4) return s def set_rbf(self, rbf): - nSequence = 0xffffffff - (2 if rbf else 0) + nSequence = 0xffffffff - (2 if rbf else 1) for txin in self.inputs(): txin['sequence'] = nSequence @@ -716,12 +716,12 @@ class Transaction: txin = inputs[i] if self.is_segwit_input(txin): hashPrevouts = Hash(''.join(self.serialize_outpoint(txin) for txin in inputs).decode('hex')).encode('hex') - hashSequence = Hash(''.join(int_to_hex(txin.get('sequence', 0xffffffff), 4) for txin in inputs).decode('hex')).encode('hex') + hashSequence = Hash(''.join(int_to_hex(txin.get('sequence', 0xffffffff - 1), 4) for txin in inputs).decode('hex')).encode('hex') hashOutputs = Hash(''.join(self.serialize_output(o) for o in outputs).decode('hex')).encode('hex') outpoint = self.serialize_outpoint(txin) scriptCode = push_script(self.get_preimage_script(txin)) amount = int_to_hex(txin['value'], 8) - nSequence = int_to_hex(txin.get('sequence', 0xffffffff), 4) + nSequence = int_to_hex(txin.get('sequence', 0xffffffff - 1), 4) preimage = nVersion + hashPrevouts + hashSequence + outpoint + scriptCode + amount + nSequence + hashOutputs + nLocktime + nHashType else: txins = var_int(len(inputs)) + ''.join(self.serialize_input(txin, self.get_preimage_script(txin) if i==k else '') for k, txin in enumerate(inputs)) @@ -780,7 +780,7 @@ class Transaction: return self.input_value() - self.output_value() def is_final(self): - return not any([x.get('sequence', 0xffffffff) < 0xffffffff - 1 for x in self.inputs()]) + return not any([x.get('sequence', 0xffffffff - 1) < 0xffffffff - 1 for x in self.inputs()]) @profiler def estimated_size(self):