Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
094f8d464d | ||
|
|
e15f45ac95 | ||
|
|
2ebb24bac6 | ||
|
|
2ed1bec0b4 | ||
|
|
759532479f | ||
|
|
098c99c3a1 | ||
|
|
e9d8e34ab4 | ||
|
|
f5ee1f0b69 | ||
|
|
5eb505331f | ||
|
|
3c4f9d4537 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -10,3 +10,6 @@
|
|||||||
[submodule "externals/quarkcoin-hash"]
|
[submodule "externals/quarkcoin-hash"]
|
||||||
path = externals/quarkcoin-hash
|
path = externals/quarkcoin-hash
|
||||||
url = https://github.com/Neisklar/quarkcoin-hash-python
|
url = https://github.com/Neisklar/quarkcoin-hash-python
|
||||||
|
[submodule "externals/maxcoin-hash-python"]
|
||||||
|
path = externals/maxcoin-hash-python
|
||||||
|
url = https://github.com/Prydie/maxcoin-hash-python
|
||||||
|
|||||||
1
externals/maxcoin-hash-python
vendored
Submodule
1
externals/maxcoin-hash-python
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 30cfcd105ae2914ae12b750ae7471e27f79c28ed
|
||||||
@ -34,6 +34,8 @@ class BitcoinRPC(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _call(self, method, params):
|
def _call(self, method, params):
|
||||||
|
#log.debug("RPC Call: %s" % json.dumps({'jsonrpc': '2.0', 'method':
|
||||||
|
#method,'params': params,'id': '1'}))
|
||||||
return self._call_raw(json.dumps({
|
return self._call_raw(json.dumps({
|
||||||
'jsonrpc': '2.0',
|
'jsonrpc': '2.0',
|
||||||
'method': method,
|
'method': method,
|
||||||
|
|||||||
@ -26,16 +26,15 @@ if settings.COINDAEMON_ALGO == 'scrypt':
|
|||||||
elif settings.COINDAEMON_ALGO == 'quark':
|
elif settings.COINDAEMON_ALGO == 'quark':
|
||||||
log.debug("########################################### Loading Quark Support #########################################################")
|
log.debug("########################################### Loading Quark Support #########################################################")
|
||||||
import quark_hash
|
import quark_hash
|
||||||
|
elif settings.COINDAEMON_ALGO == 'max':
|
||||||
|
log.debug("########################################### Loading Max Support #########################################################")
|
||||||
|
import max_hash
|
||||||
|
from sha3 import sha3_256
|
||||||
|
elif settings.COINDAEMON_ALGO == 'keccak':
|
||||||
|
import sha3
|
||||||
else:
|
else:
|
||||||
log.debug("########################################### Loading SHA256 Support ######################################################")
|
log.debug("########################################### Loading SHA256 Support ######################################################")
|
||||||
|
|
||||||
#if settings.COINDAEMON_Reward == 'POS':
|
|
||||||
# log.debug("########################################### Loading POS Support #########################################################")
|
|
||||||
# pass
|
|
||||||
#else:
|
|
||||||
# log.debug("########################################### Loading POW Support ######################################################")
|
|
||||||
# pass
|
|
||||||
|
|
||||||
if settings.COINDAEMON_TX == 'yes':
|
if settings.COINDAEMON_TX == 'yes':
|
||||||
log.debug("########################################### Loading SHA256 Transaction Message Support #########################################################")
|
log.debug("########################################### Loading SHA256 Transaction Message Support #########################################################")
|
||||||
pass
|
pass
|
||||||
@ -156,6 +155,8 @@ class CTxOut(object):
|
|||||||
|
|
||||||
class CTransaction(object):
|
class CTransaction(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
if settings.COINDAEMON_ALGO == 'max':
|
||||||
|
self.sha3 = None
|
||||||
if settings.COINDAEMON_Reward == 'POW':
|
if settings.COINDAEMON_Reward == 'POW':
|
||||||
self.nVersion = 1
|
self.nVersion = 1
|
||||||
if settings.COINDAEMON_TX == 'yes':
|
if settings.COINDAEMON_TX == 'yes':
|
||||||
@ -239,6 +240,10 @@ class CBlock(object):
|
|||||||
self.scrypt = None
|
self.scrypt = None
|
||||||
elif settings.COINDAEMON_ALGO == 'quark':
|
elif settings.COINDAEMON_ALGO == 'quark':
|
||||||
self.quark = None
|
self.quark = None
|
||||||
|
elif settings.COINDAEMON_ALGO == 'max':
|
||||||
|
self.max = None
|
||||||
|
elif settings.COINDAEMON_ALGO == 'keccak':
|
||||||
|
self.sha3 = None
|
||||||
else: pass
|
else: pass
|
||||||
if settings.COINDAEMON_Reward == 'POS':
|
if settings.COINDAEMON_Reward == 'POS':
|
||||||
self.signature = b""
|
self.signature = b""
|
||||||
@ -294,6 +299,36 @@ class CBlock(object):
|
|||||||
r.append(struct.pack("<I", self.nNonce))
|
r.append(struct.pack("<I", self.nNonce))
|
||||||
self.quark = uint256_from_str(quark_hash.getPoWHash(''.join(r)))
|
self.quark = uint256_from_str(quark_hash.getPoWHash(''.join(r)))
|
||||||
return self.quark
|
return self.quark
|
||||||
|
elif settings.COINDAEMON_ALGO == 'max':
|
||||||
|
def calc_max(self):
|
||||||
|
if self.max is None:
|
||||||
|
r = []
|
||||||
|
r.append(struct.pack("<i", self.nVersion))
|
||||||
|
r.append(ser_uint256(self.hashPrevBlock))
|
||||||
|
r.append(ser_uint256(self.hashMerkleRoot))
|
||||||
|
r.append(struct.pack("<I", self.nTime))
|
||||||
|
r.append(struct.pack("<I", self.nBits))
|
||||||
|
r.append(struct.pack("<I", self.nNonce))
|
||||||
|
self.max = uint256_from_str(sha3_256(''.join(r)).digest())
|
||||||
|
return self.max
|
||||||
|
elif settings.COINDAEMON_ALGO == 'keccak':
|
||||||
|
def calc_sha3(self):
|
||||||
|
if self.sha3 is None:
|
||||||
|
r = []
|
||||||
|
r.append(struct.pack("<i", self.nVersion))
|
||||||
|
r.append(ser_uint256(self.hashPrevBlock))
|
||||||
|
r.append(ser_uint256(self.hashMerkleRoot))
|
||||||
|
r.append(struct.pack("<I", self.nTime))
|
||||||
|
r.append(struct.pack("<I", self.nBits))
|
||||||
|
r.append(struct.pack("<I", self.nNonce))
|
||||||
|
s = sha3.SHA3256()
|
||||||
|
s.update(''.join(r) + str(self.nTime))
|
||||||
|
# hash_bin_temp = s.hexdigest()
|
||||||
|
# s = sha3.SHA3256()
|
||||||
|
# s.update(hash_bin_temp)
|
||||||
|
block_hash_bin = s.hexdigest()
|
||||||
|
self.sha3 = uint256_from_str(block_hash_bin)
|
||||||
|
return self.sha3
|
||||||
else:
|
else:
|
||||||
def calc_sha256(self):
|
def calc_sha256(self):
|
||||||
if self.sha256 is None:
|
if self.sha256 is None:
|
||||||
@ -313,6 +348,10 @@ class CBlock(object):
|
|||||||
self.calc_scrypt()
|
self.calc_scrypt()
|
||||||
elif settings.COINDAEMON_ALGO == 'quark':
|
elif settings.COINDAEMON_ALGO == 'quark':
|
||||||
self.calc_quark()
|
self.calc_quark()
|
||||||
|
elif settings.COINDAEMON_ALGO == 'max':
|
||||||
|
self.calc_max()
|
||||||
|
elif settings.COINDAEMON_ALGO == 'keccak':
|
||||||
|
self.calc_sha3()
|
||||||
else:
|
else:
|
||||||
self.calc_sha256()
|
self.calc_sha256()
|
||||||
|
|
||||||
@ -324,6 +363,12 @@ class CBlock(object):
|
|||||||
elif settings.COINDAEMON_ALGO == 'quark':
|
elif settings.COINDAEMON_ALGO == 'quark':
|
||||||
if self.quark > target:
|
if self.quark > target:
|
||||||
return False
|
return False
|
||||||
|
elif settings.COINDAEMON_ALGO == 'max':
|
||||||
|
if self.max > target:
|
||||||
|
return False
|
||||||
|
elif settings.COINDAEMON_ALGO == 'sha3':
|
||||||
|
if self.sha3 > target:
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
if self.sha256 > target:
|
if self.sha256 > target:
|
||||||
return False
|
return False
|
||||||
|
|||||||
@ -3,18 +3,24 @@ import binascii
|
|||||||
import util
|
import util
|
||||||
import StringIO
|
import StringIO
|
||||||
import settings
|
import settings
|
||||||
|
from hashlib import sha256
|
||||||
if settings.COINDAEMON_ALGO == 'scrypt':
|
if settings.COINDAEMON_ALGO == 'scrypt':
|
||||||
import ltc_scrypt
|
import ltc_scrypt
|
||||||
elif settings.COINDAEMON_ALGO == 'scrypt-jane':
|
elif settings.COINDAEMON_ALGO == 'scrypt-jane':
|
||||||
import yac_scrypt
|
import yac_scrypt
|
||||||
elif settings.COINDAEMON_ALGO == 'quark':
|
elif settings.COINDAEMON_ALGO == 'quark':
|
||||||
import quark_hash
|
import quark_hash
|
||||||
|
elif settings.COINDAEMON_ALGO == 'max':
|
||||||
|
import max_hash
|
||||||
|
from sha3 import sha3_256
|
||||||
elif settings.COINDAEMON_ALGO == 'skeinhash':
|
elif settings.COINDAEMON_ALGO == 'skeinhash':
|
||||||
import skeinhash
|
import skeinhash
|
||||||
|
elif settings.COINDAEMON_ALGO == 'keccak':
|
||||||
|
import sha3
|
||||||
else: pass
|
else: pass
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from lib.exceptions import SubmitException
|
from lib.exceptions import SubmitException
|
||||||
|
|
||||||
import lib.logger
|
import lib.logger
|
||||||
log = lib.logger.get_logger('template_registry')
|
log = lib.logger.get_logger('template_registry')
|
||||||
log.debug("Got to Template Registry")
|
log.debug("Got to Template Registry")
|
||||||
@ -22,7 +28,6 @@ from mining.interfaces import Interfaces
|
|||||||
from extranonce_counter import ExtranonceCounter
|
from extranonce_counter import ExtranonceCounter
|
||||||
import lib.settings as settings
|
import lib.settings as settings
|
||||||
|
|
||||||
|
|
||||||
class JobIdGenerator(object):
|
class JobIdGenerator(object):
|
||||||
'''Generate pseudo-unique job_id. It does not need to be absolutely unique,
|
'''Generate pseudo-unique job_id. It does not need to be absolutely unique,
|
||||||
because pool sends "clean_jobs" flag to clients and they should drop all previous jobs.'''
|
because pool sends "clean_jobs" flag to clients and they should drop all previous jobs.'''
|
||||||
@ -126,8 +131,8 @@ class TemplateRegistry(object):
|
|||||||
|
|
||||||
self.update_in_progress = True
|
self.update_in_progress = True
|
||||||
self.last_update = Interfaces.timestamper.time()
|
self.last_update = Interfaces.timestamper.time()
|
||||||
|
|
||||||
d = self.bitcoin_rpc.getblocktemplate()
|
d = self.bitcoin_rpc.getblocktemplate()
|
||||||
d.addCallback(self._update_block)
|
d.addCallback(self._update_block)
|
||||||
d.addErrback(self._update_block_failed)
|
d.addErrback(self._update_block_failed)
|
||||||
|
|
||||||
@ -137,8 +142,7 @@ class TemplateRegistry(object):
|
|||||||
|
|
||||||
def _update_block(self, data):
|
def _update_block(self, data):
|
||||||
start = Interfaces.timestamper.time()
|
start = Interfaces.timestamper.time()
|
||||||
|
template = self.block_template_class(Interfaces.timestamper, self.coinbaser, JobIdGenerator.get_new_id())
|
||||||
template = self.block_template_class(Interfaces.timestamper, self.coinbaser, JobIdGenerator.get_new_id())
|
|
||||||
log.info(template.fill_from_rpc(data))
|
log.info(template.fill_from_rpc(data))
|
||||||
self.add_template(template,data['height'])
|
self.add_template(template,data['height'])
|
||||||
|
|
||||||
@ -154,9 +158,12 @@ class TemplateRegistry(object):
|
|||||||
diff1 = 0x0000ffff00000000000000000000000000000000000000000000000000000000
|
diff1 = 0x0000ffff00000000000000000000000000000000000000000000000000000000
|
||||||
elif settings.COINDAEMON_ALGO == 'quark':
|
elif settings.COINDAEMON_ALGO == 'quark':
|
||||||
diff1 = 0x000000ffff000000000000000000000000000000000000000000000000000000
|
diff1 = 0x000000ffff000000000000000000000000000000000000000000000000000000
|
||||||
|
elif settings.coindaemon_algo == 'max':
|
||||||
|
diff1 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000
|
||||||
|
elif settings.COINDAEMON_ALGO == 'keccak':
|
||||||
|
diff1 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000
|
||||||
else:
|
else:
|
||||||
diff1 = 0x00000000ffff0000000000000000000000000000000000000000000000000000
|
diff1 = 0x00000000ffff0000000000000000000000000000000000000000000000000000
|
||||||
|
|
||||||
return diff1 / difficulty
|
return diff1 / difficulty
|
||||||
|
|
||||||
def get_job(self, job_id):
|
def get_job(self, job_id):
|
||||||
@ -228,7 +235,10 @@ class TemplateRegistry(object):
|
|||||||
|
|
||||||
# 1. Build coinbase
|
# 1. Build coinbase
|
||||||
coinbase_bin = job.serialize_coinbase(extranonce1_bin, extranonce2_bin)
|
coinbase_bin = job.serialize_coinbase(extranonce1_bin, extranonce2_bin)
|
||||||
coinbase_hash = util.doublesha(coinbase_bin)
|
if settings.COINDAEMON_ALGO == 'max':
|
||||||
|
coinbase_hash = sha256(coinbase_bin).digest()
|
||||||
|
else:
|
||||||
|
coinbase_hash = util.doublesha(coinbase_bin)
|
||||||
|
|
||||||
# 2. Calculate merkle root
|
# 2. Calculate merkle root
|
||||||
merkle_root_bin = job.merkletree.withFirst(coinbase_hash)
|
merkle_root_bin = job.merkletree.withFirst(coinbase_hash)
|
||||||
@ -244,9 +254,17 @@ class TemplateRegistry(object):
|
|||||||
hash_bin = yac_scrypt.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]), int(ntime, 16))
|
hash_bin = yac_scrypt.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]), int(ntime, 16))
|
||||||
elif settings.COINDAEMON_ALGO == 'quark':
|
elif settings.COINDAEMON_ALGO == 'quark':
|
||||||
hash_bin = quark_hash.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
hash_bin = quark_hash.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
||||||
|
elif settings.COINDAEMON_ALGO == 'max':
|
||||||
|
hash_bin = max_hash.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
||||||
|
hash_bin = sha3_256(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ])).digest()[0:33]
|
||||||
elif settings.COINDAEMON_ALGO == 'skeinhash':
|
elif settings.COINDAEMON_ALGO == 'skeinhash':
|
||||||
hash_bin = skeinhash.skeinhash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
hash_bin = skeinhash.skeinhash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
||||||
else:
|
elif settings.COINDAEMON_ALGO == 'keccak':
|
||||||
|
s = sha3.sha3_256()
|
||||||
|
ntime1 = str(int(ntime, 16))
|
||||||
|
s.update(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]) + ntime1)
|
||||||
|
hash_bin = s.hexdigest()
|
||||||
|
else:
|
||||||
hash_bin = util.doublesha(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
hash_bin = util.doublesha(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
||||||
|
|
||||||
hash_int = util.uint256_from_str(hash_bin)
|
hash_int = util.uint256_from_str(hash_bin)
|
||||||
@ -256,11 +274,14 @@ class TemplateRegistry(object):
|
|||||||
header_hex = header_hex+"000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
|
header_hex = header_hex+"000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
|
||||||
elif settings.COINDAEMON_ALGO == 'quark':
|
elif settings.COINDAEMON_ALGO == 'quark':
|
||||||
header_hex = header_hex+"000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
|
header_hex = header_hex+"000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
|
||||||
|
#elif settings.COINDAEMON_ALGO == 'max':
|
||||||
|
#header_hex = header_hex+"000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
|
||||||
else: pass
|
else: pass
|
||||||
|
|
||||||
target_user = self.diff_to_target(difficulty)
|
target_user = self.diff_to_target(difficulty)
|
||||||
if hash_int > target_user:
|
if hash_int > target_user:
|
||||||
raise SubmitException("Share is above target")
|
raise SubmitException("Share is above target. Hash: %s",
|
||||||
|
scrypt_hash_hex)
|
||||||
|
|
||||||
# Mostly for debugging purposes
|
# Mostly for debugging purposes
|
||||||
target_info = self.diff_to_target(100000)
|
target_info = self.diff_to_target(100000)
|
||||||
@ -276,12 +297,18 @@ class TemplateRegistry(object):
|
|||||||
log.info("We found a block candidate! %s" % scrypt_hash_hex)
|
log.info("We found a block candidate! %s" % scrypt_hash_hex)
|
||||||
|
|
||||||
# Reverse the header and get the potential block hash (for scrypt only)
|
# Reverse the header and get the potential block hash (for scrypt only)
|
||||||
#if settings.COINDAEMON_ALGO == 'scrypt' or settings.COINDAEMON_ALGO == 'sha256d':
|
if settings.COINDAEMON_ALGO == 'max':
|
||||||
# if settings.COINDAEMON_Reward == 'POW':
|
block_hash_bin = sha3_256(''.join([ header_bin[i*4:i*4+4][::-1]
|
||||||
block_hash_bin = util.doublesha(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
for i in range(0, 20) ]) + str(int(ntime, 16))).hexdigest()
|
||||||
|
elif settings.COINDAEMON_ALGO == 'keccak':
|
||||||
|
s = sha3.SHA3256()
|
||||||
|
ntime1 = str(int(ntime, 16))
|
||||||
|
s.update(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]) + ntime1)
|
||||||
|
else:
|
||||||
|
block_hash_bin = util.doublesha(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
||||||
block_hash_hex = block_hash_bin[::-1].encode('hex_codec')
|
block_hash_hex = block_hash_bin[::-1].encode('hex_codec')
|
||||||
#else: block_hash_hex = hash_bin[::-1].encode('hex_codec')
|
if settings.COINDAEMON_ALGO != 'max':
|
||||||
#else: block_hash_hex = hash_bin[::-1].encode('hex_codec')
|
block_hash_hex = hash_bin[::-1].encode('hex_codec')
|
||||||
# 6. Finalize and serialize block object
|
# 6. Finalize and serialize block object
|
||||||
job.finalize(merkle_root_int, extranonce1_bin, extranonce2_bin, int(ntime, 16), int(nonce, 16))
|
job.finalize(merkle_root_int, extranonce1_bin, extranonce2_bin, int(ntime, 16), int(nonce, 16))
|
||||||
|
|
||||||
@ -291,7 +318,7 @@ class TemplateRegistry(object):
|
|||||||
|
|
||||||
# 7. Submit block to the network
|
# 7. Submit block to the network
|
||||||
serialized = binascii.hexlify(job.serialize())
|
serialized = binascii.hexlify(job.serialize())
|
||||||
on_submit = self.bitcoin_rpc.submitblock(serialized, block_hash_hex, scrypt_hash_hex)
|
on_submit = self.bitcoin_rpc.submitblock(serialized, block_hash_hex, scrypt_hash_hex)
|
||||||
if on_submit:
|
if on_submit:
|
||||||
self.update_block()
|
self.update_block()
|
||||||
|
|
||||||
@ -302,8 +329,14 @@ class TemplateRegistry(object):
|
|||||||
|
|
||||||
if settings.SOLUTION_BLOCK_HASH:
|
if settings.SOLUTION_BLOCK_HASH:
|
||||||
# Reverse the header and get the potential block hash (for scrypt only) only do this if we want to send in the block hash to the shares table
|
# Reverse the header and get the potential block hash (for scrypt only) only do this if we want to send in the block hash to the shares table
|
||||||
block_hash_bin = util.doublesha(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
if settings.COINDAEMON_ALGO == 'keccak':
|
||||||
block_hash_hex = block_hash_bin[::-1].encode('hex_codec')
|
s = sha3.sha3_256()
|
||||||
return (header_hex, block_hash_hex, share_diff, None)
|
ntime1 = str(int(ntime, 16))
|
||||||
|
s.update(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]) + ntime1)
|
||||||
|
block_hash_bin = s.hexdigest()
|
||||||
|
else:
|
||||||
|
block_hash_bin = util.doublesha(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
|
||||||
|
block_hash_hex = block_hash_bin[::-1].encode('hex_codec')
|
||||||
|
return (header_hex, block_hash_hex, share_diff, None)
|
||||||
else:
|
else:
|
||||||
return (header_hex, scrypt_hash_hex, share_diff, None)
|
return (header_hex, scrypt_hash_hex, share_diff, None)
|
||||||
|
|||||||
16
lib/util.py
16
lib/util.py
@ -7,6 +7,11 @@ import settings
|
|||||||
import bitcoin_rpc
|
import bitcoin_rpc
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
|
|
||||||
|
if settings.COINDAEMON_ALGO == 'keccak':
|
||||||
|
import sha3
|
||||||
|
from sha3 import sha3_256
|
||||||
|
|
||||||
|
|
||||||
def deser_string(f):
|
def deser_string(f):
|
||||||
nit = struct.unpack("<B", f.read(1))[0]
|
nit = struct.unpack("<B", f.read(1))[0]
|
||||||
if nit == 253:
|
if nit == 253:
|
||||||
@ -176,14 +181,19 @@ def address_to_pubkeyhash(addr):
|
|||||||
|
|
||||||
if addr is None:
|
if addr is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
ver = addr[0]
|
ver = addr[0]
|
||||||
cksumA = addr[-4:]
|
cksumA = addr[-4:]
|
||||||
cksumB = doublesha(addr[:-4])[:4]
|
if settings.COINDAEMON_ALGO != 'max':
|
||||||
|
cksumB = doublesha(addr[:-4])[:4]
|
||||||
|
#TODO: We should clean this up so that it works with not Keccek implementations too.
|
||||||
|
else:
|
||||||
|
cksumB = sha3_256(addr[:-4]).digest()[:4]
|
||||||
|
|
||||||
|
|
||||||
if cksumA != cksumB:
|
if cksumA != cksumB:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return (ver, addr[1:-4])
|
return (ver, addr[1:-4])
|
||||||
|
|
||||||
def ser_uint256_be(u):
|
def ser_uint256_be(u):
|
||||||
|
|||||||
1
maxcoin-hash-python
Submodule
1
maxcoin-hash-python
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 30cfcd105ae2914ae12b750ae7471e27f79c28ed
|
||||||
Loading…
Reference in New Issue
Block a user