From 5eb505331ffc731bc0b43398e0bce700a5179049 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Sat, 8 Feb 2014 15:38:13 +0000 Subject: [PATCH] MaxCoin --- lib/halfnode.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/lib/halfnode.py b/lib/halfnode.py index eb29c4e..08aa56d 100644 --- a/lib/halfnode.py +++ b/lib/halfnode.py @@ -11,6 +11,7 @@ import sys import random import cStringIO from Crypto.Hash import SHA256 +from sha3 import sha3_256 from twisted.internet.protocol import Protocol from util import * @@ -26,6 +27,11 @@ if settings.COINDAEMON_ALGO == 'scrypt': elif settings.COINDAEMON_ALGO == 'quark': log.debug("########################################### Loading Quark Support #########################################################") import quark_hash +elif settings.COINDAEMON_ALGO == 'max': + log.debug("########################################### Loading Max Support #########################################################") + import max_hash +elif settings.COINDAEMON_ALGO == 'keccak': + import sha3 else: log.debug("########################################### Loading SHA256 Support ######################################################") @@ -156,6 +162,7 @@ class CTxOut(object): class CTransaction(object): def __init__(self): + self.sha3 = None if settings.COINDAEMON_Reward == 'POW': self.nVersion = 1 if settings.COINDAEMON_TX == 'yes': @@ -239,6 +246,10 @@ class CBlock(object): self.scrypt = None elif settings.COINDAEMON_ALGO == 'quark': self.quark = None + elif settings.COINDAEMON_ALGO == 'max': + self.max = None + elif settings.COINDAEMON_ALGO == 'keccak': + self.sha3 = None else: pass if settings.COINDAEMON_Reward == 'POS': self.signature = b"" @@ -294,6 +305,37 @@ class CBlock(object): r.append(struct.pack(" target: 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: if self.sha256 > target: return False