This commit is contained in:
ahmedbodi 2014-02-08 15:47:47 +00:00
parent f5ee1f0b69
commit e9d8e34ab4

View File

@ -6,6 +6,11 @@ import binascii
import settings
import bitcoin_rpc
from hashlib import sha256
from sha3 import sha3_256
if settings.COINDAEMON_ALGO == 'keccak':
import sha3
def deser_string(f):
nit = struct.unpack("<B", f.read(1))[0]
@ -176,14 +181,17 @@ def address_to_pubkeyhash(addr):
if addr is None:
return None
ver = addr[0]
cksumA = addr[-4:]
cksumB = doublesha(addr[:-4])[:4]
#TODO: We should clean this up so that it works with not Keccek implementations too.
cksumB = sha3_256(addr[:-4]).digest()[:4]
#cksumB = sha3.sha3_256(addr[:-4]).digest()[:4]
if cksumA != cksumB:
return None
return (ver, addr[1:-4])
def ser_uint256_be(u):