1
0

Python 3 and Segwit fixes

This commit is contained in:
BTChip
2017-08-30 22:49:03 +02:00
parent b86619ee30
commit e49e3d6673
2 changed files with 10 additions and 10 deletions

View File

@@ -1,4 +1,3 @@
from binascii import hexlify
from struct import pack, unpack
import hashlib
import time
@@ -175,8 +174,8 @@ class Ledger_KeyStore(Hardware_KeyStore):
self.cfg = d.get('cfg', {'mode':0,'pair':''})
def is_segwit(self):
return self.plugin.segwit
return self.derivation.startswith("m/49'/")
def dump(self):
obj = Hardware_KeyStore.dump(self)
obj['cfg'] = self.cfg
@@ -341,10 +340,10 @@ class Ledger_KeyStore(Hardware_KeyStore):
for utxo in inputs:
sequence = int_to_hex(utxo[5], 4)
if segwitTransaction:
txtmp = bitcoinTransaction(bfh(utxo[0]))
txtmp = bitcoinTransaction(bfh(utxo[0]))
tmp = bfh(utxo[3])[::-1]
tmp += bfh(int_to_hex(utxo[1], 4))
tmp += str(txtmp.outputs[utxo[1]].amount)
tmp += txtmp.outputs[utxo[1]].amount
chipInputs.append({'value' : tmp, 'witness' : True, 'sequence' : sequence})
redeemScripts.append(bfh(utxo[2]))
elif not p2shTransaction: