Compare commits

..

No commits in common. "ef1d2252e3c2cabbc90e3436d84afedf05e99ee2" and "094f8d464dee8ae324b147f950290d4bccd5f295" have entirely different histories.

3 changed files with 3 additions and 39 deletions

View File

@ -32,8 +32,6 @@ elif settings.COINDAEMON_ALGO == 'max':
from sha3 import sha3_256
elif settings.COINDAEMON_ALGO == 'keccak':
import sha3
elif settings.COINDAEMON_ALGO == 'blake':
import blake_hash
else:
log.debug("########################################### Loading SHA256 Support ######################################################")
@ -159,8 +157,6 @@ class CTransaction(object):
def __init__(self):
if settings.COINDAEMON_ALGO == 'max':
self.sha3 = None
elif settings.COINDAEMON_ALGO == 'blake':
self.blake = None
if settings.COINDAEMON_Reward == 'POW':
self.nVersion = 1
if settings.COINDAEMON_TX == 'yes':
@ -246,8 +242,6 @@ class CBlock(object):
self.quark = None
elif settings.COINDAEMON_ALGO == 'max':
self.max = None
elif settings.COINDAEMON_ALGO == 'blake':
self.blake = None
elif settings.COINDAEMON_ALGO == 'keccak':
self.sha3 = None
else: pass
@ -317,18 +311,6 @@ class CBlock(object):
r.append(struct.pack("<I", self.nNonce))
self.max = uint256_from_str(sha3_256(''.join(r)).digest())
return self.max
elif settings.COINDAEMON_ALGO == 'blake':
def calc_blake(self):
if self.blake 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.blake = uint256_from_str(blake_hash.getPoWHash(''.join(r)).digest())
return self.blake
elif settings.COINDAEMON_ALGO == 'keccak':
def calc_sha3(self):
if self.sha3 is None:
@ -368,8 +350,6 @@ class CBlock(object):
self.calc_quark()
elif settings.COINDAEMON_ALGO == 'max':
self.calc_max()
elif settings.COINDAEMON_ALGO == 'blake':
self.calc_blake()
elif settings.COINDAEMON_ALGO == 'keccak':
self.calc_sha3()
else:
@ -386,9 +366,6 @@ class CBlock(object):
elif settings.COINDAEMON_ALGO == 'max':
if self.max > target:
return False
elif settings.COINDAEMON_ALGO == 'blake':
if self.blake > target:
return False
elif settings.COINDAEMON_ALGO == 'sha3':
if self.sha3 > target:
return False

View File

@ -13,8 +13,6 @@ elif settings.COINDAEMON_ALGO == 'quark':
elif settings.COINDAEMON_ALGO == 'max':
import max_hash
from sha3 import sha3_256
elif settings.COINDAEMON_ALGO == 'blake':
import blake_ghash
elif settings.COINDAEMON_ALGO == 'skeinhash':
import skeinhash
elif settings.COINDAEMON_ALGO == 'keccak':
@ -160,10 +158,8 @@ class TemplateRegistry(object):
diff1 = 0x0000ffff00000000000000000000000000000000000000000000000000000000
elif settings.COINDAEMON_ALGO == 'quark':
diff1 = 0x000000ffff000000000000000000000000000000000000000000000000000000
elif settings.COINDAEMON_ALGO == 'max':
elif settings.coindaemon_algo == 'max':
diff1 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000
elif settings.COINDAEMON_algo == 'blake':
diff1 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000
elif settings.COINDAEMON_ALGO == 'keccak':
diff1 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000
else:
@ -239,7 +235,7 @@ class TemplateRegistry(object):
# 1. Build coinbase
coinbase_bin = job.serialize_coinbase(extranonce1_bin, extranonce2_bin)
if settings.COINDAEMON_ALGO == 'max' or settings.COINDAEMON_ALGO == 'blake':
if settings.COINDAEMON_ALGO == 'max':
coinbase_hash = sha256(coinbase_bin).digest()
else:
coinbase_hash = util.doublesha(coinbase_bin)
@ -261,8 +257,6 @@ class TemplateRegistry(object):
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 == 'blake':
hash_bin = blake_hash.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))#.digest()[0:33]
elif settings.COINDAEMON_ALGO == 'skeinhash':
hash_bin = skeinhash.skeinhash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
elif settings.COINDAEMON_ALGO == 'keccak':
@ -306,9 +300,6 @@ class TemplateRegistry(object):
if settings.COINDAEMON_ALGO == 'max':
block_hash_bin = sha3_256(''.join([ header_bin[i*4:i*4+4][::-1]
for i in range(0, 20) ]) + str(int(ntime, 16))).hexdigest()
elif settings.COINDAEMON_ALGO == 'blake':
block_hash_bin = blake_hash.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1]
for i in range(0, 20) ]) + str(int(ntime, 16))).hexdigest()
elif settings.COINDAEMON_ALGO == 'keccak':
s = sha3.SHA3256()
ntime1 = str(int(ntime, 16))

View File

@ -7,11 +7,9 @@ import settings
import bitcoin_rpc
from hashlib import sha256
if settings.COINDAEMON_ALGO == 'max' or settings.COINDAEMON_ALGO == 'keccak':
if settings.COINDAEMON_ALGO == 'keccak':
import sha3
from sha3 import sha3_256
elif settings.COINDAEMON_ALGO == 'blake':
import blake_hash
def deser_string(f):
@ -189,8 +187,6 @@ def address_to_pubkeyhash(addr):
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.
elif settings.COINDAEMON_ALcksumB = sha3_256(addr[:-4]).digest()[:4]GO == 'blake':
cksumB = blake_hash.getPoWHash(addr[:-4]).digest()[:4]
else:
cksumB = sha3_256(addr[:-4]).digest()[:4]