update to py3 encodings

This commit is contained in:
mdr0id 2019-12-04 08:01:00 -08:00
parent 843df2a31d
commit 09fa601617
1 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ def serialize_script_num(value):
neg = value < 0 neg = value < 0
absvalue = -value if neg else value absvalue = -value if neg else value
while (absvalue): while (absvalue):
r.append(chr(absvalue & 0xff)) r.append(int(absvalue & 0xff))
absvalue >>= 8 absvalue >>= 8
if r[-1] & 0x80: if r[-1] & 0x80:
r.append(0x80 if neg else 0) r.append(0x80 if neg else 0)
@ -75,6 +75,6 @@ def create_transaction(prevtx, n, sig, value):
tx = CTransaction() tx = CTransaction()
assert(n < len(prevtx.vout)) assert(n < len(prevtx.vout))
tx.vin.append(CTxIn(COutPoint(prevtx.sha256, n), sig, 0xffffffff)) tx.vin.append(CTxIn(COutPoint(prevtx.sha256, n), sig, 0xffffffff))
tx.vout.append(CTxOut(value, "")) tx.vout.append(CTxOut(value, b""))
tx.calc_sha256() tx.calc_sha256()
return tx return tx