Skip to content

Commit 8047a60

Browse files
author
Bertrand256
committed
Changes related to Python 3 support.
1 parent 31b8984 commit 8047a60

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

btchip/bitcoinTransaction.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
class bitcoinInput:
2424

2525
def __init__(self, bufferOffset=None):
26-
self.prevOut = ""
27-
self.script = ""
28-
self.sequence = ""
26+
self.prevOut = b""
27+
self.script = b""
28+
self.sequence = b""
2929
if bufferOffset is not None:
3030
buf = bufferOffset['buffer']
3131
offset = bufferOffset['offset']
@@ -48,16 +48,16 @@ def serialize(self):
4848
return result
4949

5050
def __str__(self):
51-
buf = "Prevout : " + hexlify(self.prevOut) + "\r\n"
52-
buf += "Script : " + hexlify(self.script) + "\r\n"
53-
buf += "Sequence : " + hexlify(self.sequence) + "\r\n"
51+
buf = "Prevout : " + self.prevOut.hex() + "\r\n"
52+
buf += "Script : " + self.script.hex() + "\r\n"
53+
buf += "Sequence : " + self.sequence.hex() + "\r\n"
5454
return buf
5555

5656
class bitcoinOutput:
5757

5858
def __init__(self, bufferOffset=None):
59-
self.amount = ""
60-
self.script = ""
59+
self.amount = b""
60+
self.script = b""
6161
if bufferOffset is not None:
6262
buf = bufferOffset['buffer']
6363
offset = bufferOffset['offset']
@@ -77,20 +77,20 @@ def serialize(self):
7777
return result
7878

7979
def __str__(self):
80-
buf = "Amount : " + hexlify(self.amount) + "\r\n"
81-
buf += "Script : " + hexlify(self.script) + "\r\n"
80+
buf = "Amount : " + self.amount.hex() + "\r\n"
81+
buf += "Script : " + self.script.hex() + "\r\n"
8282
return buf
8383

8484

8585
class bitcoinTransaction:
8686

8787
def __init__(self, data=None):
88-
self.version = ""
88+
self.version = b""
8989
self.inputs = []
9090
self.outputs = []
91-
self.lockTime = ""
91+
self.lockTime = b""
9292
self.witness = False
93-
self.witnessScript = ""
93+
self.witnessScript = b""
9494
if data is not None:
9595
offset = 0
9696
self.version = data[offset:offset + 4]
@@ -148,7 +148,7 @@ def serializeOutputs(self):
148148
return result
149149

150150
def __str__(self):
151-
buf = "Version : " + hexlify(self.version) + "\r\n"
151+
buf = "Version : " + self.version.hex() + "\r\n"
152152
index = 1
153153
for trinput in self.inputs:
154154
buf += "Input #" + str(index) + "\r\n"
@@ -159,7 +159,7 @@ def __str__(self):
159159
buf += "Output #" + str(index) + "\r\n"
160160
buf += str(troutput)
161161
index+=1
162-
buf += "Locktime : " + hexlify(self.lockTime) + "\r\n"
162+
buf += "Locktime : " + self.lockTime.hex() + "\r\n"
163163
if self.witness:
164-
buf += "Witness script : " + hexlify(self.witnessScript) + "\r\n"
164+
buf += "Witness script : " + self.witnessScript.hex() + "\r\n"
165165
return buf

0 commit comments

Comments
 (0)