electrum

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

commit 4276eebaf03a526e7e57f963226502f198e1c4b5
parent b7e8147ca8bf09f6d952aacf33bbb6ac0c88f2ac
Author: ThomasV <thomasv@electrum.org>
Date:   Sat,  2 Sep 2017 03:57:54 +0200

Merge pull request #2832 from TadasVaranavicius/fixes_for_python3

Python 3 fixes for Segwit
Diffstat:
Mlib/transaction.py | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/transaction.py b/lib/transaction.py @@ -426,7 +426,7 @@ def parse_input(vds): def parse_witness(vds): n = vds.read_compact_size() - return list(vds.read_bytes(vds.read_compact_size()).encode('hex') for i in xrange(n)) + return list(vds.read_bytes(vds.read_compact_size()) for i in range(n)) def parse_output(vds, i): d = {} @@ -448,7 +448,7 @@ def deserialize(raw): is_segwit = (n_vin == 0) if is_segwit: marker = vds.read_bytes(1) - assert marker == 1 + assert marker == b'\x01' n_vin = vds.read_compact_size() d['inputs'] = [parse_input(vds) for i in range(n_vin)] n_vout = vds.read_compact_size() @@ -714,7 +714,7 @@ class Transaction: hashOutputs = bh2u(Hash(bfh(''.join(self.serialize_output(o) for o in outputs)))) outpoint = self.serialize_outpoint(txin) preimage_script = self.get_preimage_script(txin) - scriptCode = var_int(len(preimage_script)/2) + preimage_script + scriptCode = var_int(len(preimage_script) // 2) + preimage_script amount = int_to_hex(txin['value'], 8) nSequence = int_to_hex(txin.get('sequence', 0xffffffff - 1), 4) preimage = nVersion + hashPrevouts + hashSequence + outpoint + scriptCode + amount + nSequence + hashOutputs + nLocktime + nHashType