Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 8fc41db

Browse files
committed
Python 3 support WIP
1 parent 5b265d1 commit 8fc41db

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

btchip/btchip.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def getTrustedInput(self, transaction, index):
134134
result = {}
135135
# Header
136136
apdu = [ self.BTCHIP_CLA, self.BTCHIP_INS_GET_TRUSTED_INPUT, 0x00, 0x00 ]
137-
params = bytearray(("%.8x" % (index)).decode('hex'))
137+
params = bytearray.fromhex("%.8x" % (index))
138138
params.extend(transaction.version)
139139
writeVarint(len(transaction.inputs), params)
140140
apdu.append(len(params))
@@ -155,7 +155,7 @@ def getTrustedInput(self, transaction, index):
155155
dataLength = blockLength
156156
else:
157157
dataLength = len(trinput.script) - offset
158-
params = trinput.script[offset : offset + dataLength]
158+
params = bytearray(trinput.script[offset : offset + dataLength])
159159
if ((offset + dataLength) == len(trinput.script)):
160160
params.extend(trinput.sequence)
161161
apdu = [ self.BTCHIP_CLA, self.BTCHIP_INS_GET_TRUSTED_INPUT, 0x80, 0x00, len(params) ]
@@ -227,7 +227,7 @@ def startUntrustedTransaction(self, newTransaction, inputIndex, outputList, rede
227227
sequence = bytearray([0xFF, 0xFF, 0xFF, 0xFF]) # default sequence
228228
apdu = [ self.BTCHIP_CLA, self.BTCHIP_INS_HASH_INPUT_START, 0x80, 0x00 ]
229229
params = []
230-
script = redeemScript
230+
script = bytearray(redeemScript)
231231
if ('witness' in passedOutput) and passedOutput['witness']:
232232
params.append(0x02)
233233
elif ('trustedInput' in passedOutput) and passedOutput['trustedInput']:

0 commit comments

Comments
 (0)