From cbd0a5edf5aee6721f6f3fcdf6d8d04035536178 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Thu, 9 Jan 2014 09:38:48 +0000 Subject: [PATCH 01/23] MemCache --- conf/config_sample.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/conf/config_sample.py b/conf/config_sample.py index fd52406..85d29d2 100644 --- a/conf/config_sample.py +++ b/conf/config_sample.py @@ -191,3 +191,11 @@ NOTIFY_EMAIL_SERVER = 'localhost' # E-Mail Sender NOTIFY_EMAIL_USERNAME = '' # E-Mail server SMTP Logon NOTIFY_EMAIL_PASSWORD = '' NOTIFY_EMAIL_USETLS = True + +#### Memcache #### +# Memcahce is a requirement. Enter the settings below +MEMCACHE_HOST = "localhost" # hostname or IP that runs memcached +MEMCACHE_PORT = 11211 # Port +MEMCACHE_TIMEOUT = 900 # Key timeout +MEMCACHE_PREFIX = "stratum_" # Prefix for keys + From 1c6f8b772d4ce4c670cc82af66a659d4b86b661c Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Thu, 9 Jan 2014 09:39:34 +0000 Subject: [PATCH 02/23] MemCache --- mining/Cache.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 mining/Cache.py diff --git a/mining/Cache.py b/mining/Cache.py new file mode 100644 index 0000000..5f5219e --- /dev/null +++ b/mining/Cache.py @@ -0,0 +1,24 @@ +''' A simple wrapper for pylibmc. It can be overwritten with simple hashing if necessary ''' +import lib.settings as settings +import lib.logger +log = lib.logger.get_logger('Cache') + +import pylibmc + +class Cache(): + def __init__(self): + # Open a new connection + self.mc = pylibmc.Client([settings.MEMCACHE_HOST + ":" + str(settings.MEMCACHE_PORT)], binary=True) + log.info("Caching initialized") + + def set(self, key, value, time=settings.MEMCACHE_TIMEOUT): + return self.mc.set(settings.MEMCACHE_PREFIX + str(key), value, time) + + def get(self, key): + return self.mc.get(settings.MEMCACHE_PREFIX + str(key)) + + def delete(self, key): + return self.mc.delete(settings.MEMCACHE_PREFIX + str(key)) + + def exists(self, key): + return str(key) in self.mc.get(settings.MEMCACHE_PREFIX + str(key)) From 32205b9a7cd09b194b9acbc1f87619420cbd2441 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Thu, 9 Jan 2014 09:50:39 +0000 Subject: [PATCH 03/23] MemCache --- mining/DBInterface.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/mining/DBInterface.py b/mining/DBInterface.py index f494713..3bf802d 100644 --- a/mining/DBInterface.py +++ b/mining/DBInterface.py @@ -3,6 +3,7 @@ import time from datetime import datetime import Queue import signal +import Cache import lib.settings as settings @@ -19,8 +20,7 @@ class DBInterface(): self.q = Queue.Queue() self.queueclock = None - self.usercache = {} - self.clearusercache() + self.cache = Cache.Cache() self.nextStatsUpdate = 0 @@ -67,11 +67,6 @@ class DBInterface(): return DB_None.DB_None() - def clearusercache(self): - log.debug("DBInterface.clearusercache called") - self.usercache = {} - self.usercacheclock = reactor.callLater(settings.DB_USERCACHE_TIME , self.clearusercache) - def scheduleImport(self): # This schedule's the Import if settings.DATABASE_DRIVER == "sqlite": @@ -163,19 +158,16 @@ class DBInterface(): # Force username and password to be strings username = str(username) password = str(password) - wid = username + ":-:" + password - - if wid in self.usercache: + if not settings.USERS_CHECK_PASSWORD and self.user_exists(username): return True - elif not settings.USERS_CHECK_PASSWORD and self.user_exists(username): - self.usercache[wid] = 1 + elif self.cache.get(username) == password: return True elif self.dbi.check_password(username, password): - self.usercache[wid] = 1 + self.cache.set(username, password) return True elif settings.USERS_AUTOADD == True: self.insert_user(username, password) - self.usercache[wid] = 1 + self.cache.set(username, password) return True log.info("Authentication for %s failed" % username) @@ -188,6 +180,8 @@ class DBInterface(): return self.dbi.get_user(id) def user_exists(self, username): + if self.cache.get(username) is not None: + return True user = self.dbi.get_user(username) return user is not None @@ -195,11 +189,13 @@ class DBInterface(): return self.dbi.insert_user(username, password) def delete_user(self, username): + self.mc.delete(username) self.usercache = {} return self.dbi.delete_user(username) def update_user(self, username, password): - self.usercache = {} + self.mc.delete(username) + self.mc.set(username, password) return self.dbi.update_user(username, password) def update_worker_diff(self, username, diff): From ae64e4949e09d161c396a6c5cba6a54f250761a2 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Thu, 16 Jan 2014 09:35:40 +0000 Subject: [PATCH 04/23] Found Block Missing --- mining/DB_Mysql_Vardiff.py | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/mining/DB_Mysql_Vardiff.py b/mining/DB_Mysql_Vardiff.py index 36ad69e..be6f49f 100644 --- a/mining/DB_Mysql_Vardiff.py +++ b/mining/DB_Mysql_Vardiff.py @@ -59,6 +59,72 @@ class DB_Mysql_Vardiff(DB_Mysql.DB_Mysql): ) self.dbh.commit() + + def found_block(self, data): + # for database compatibility we are converting our_worker to Y/N format + if data[5]: + data[5] = 'Y' + else: + data[5] = 'N' + + # Check for the share in the database before updating it + # Note: We can't use DUPLICATE KEY because solution is not a key + + self.execute( + """ + Select `id` from `shares` + WHERE `solution` = %(solution)s + LIMIT 1 + """, + { + "solution": data[2] + } + ) + + shareid = self.dbc.fetchone() + + if shareid[0] > 0: + # Note: difficulty = -1 here + self.execute( + """ + UPDATE `shares` + SET `upstream_result` = %(result)s + WHERE `solution` = %(solution)s + AND `id` = %(id)s + LIMIT 1 + """, + { + "result": data[5], + "solution": data[2], + "id": shareid[0] + } + ) + + self.dbh.commit() + else: + self.execute( + """ + INSERT INTO `shares` + (time, rem_host, username, our_result, + upstream_result, reason, solution) + VALUES + (FROM_UNIXTIME(%(time)s), %(host)s, + %(uname)s, + %(lres)s, %(result)s, %(reason)s, %(solution)s) + """, + { + "time": v[4], + "host": v[6], + "uname": v[0], + "lres": v[5], + "result": v[5], + "reason": v[9], + "solution": v[2] + } + ) + + self.dbh.commit() + def update_worker_diff(self, username, diff): log.debug("Setting difficulty for %s to %s", username, diff) From b68b75d03d4dd7d588ffbfb4b24eecf57643f323 Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Sun, 19 Jan 2014 08:40:47 -0800 Subject: [PATCH 05/23] auto-detect POS/POW --- lib/block_template.py | 6 ++++-- lib/coinbasetx.py | 18 +++++++++--------- lib/halfnode.py | 30 +++++++++++++++--------------- mining/__init__.py | 14 +++++++------- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/lib/block_template.py b/lib/block_template.py index 4e00675..9a55f50 100644 --- a/lib/block_template.py +++ b/lib/block_template.py @@ -5,6 +5,8 @@ import struct import util import merkletree import halfnode +from coinbasetx import CoinbaseTransactionPOW +from coinbasetx import CoinbaseTransactionPOS from coinbasetx import CoinbaseTransaction import lib.logger log = lib.logger.get_logger('block_template') @@ -55,10 +57,10 @@ class BlockTemplate(halfnode.CBlock): txhashes = [None] + [ util.ser_uint256(int(t['hash'], 16)) for t in data['transactions'] ] mt = merkletree.MerkleTree(txhashes) if settings.COINDAEMON_Reward == 'POW': - coinbase = self.coinbase_transaction_class(self.timestamper, self.coinbaser, data['coinbasevalue'], data['coinbaseaux']['flags'], data['height'], + coinbase = CoinbaseTransactionPOW(self.timestamper, self.coinbaser, data['coinbasevalue'], data['coinbaseaux']['flags'], data['height'], settings.COINBASE_EXTRAS) else: - coinbase = self.coinbase_transaction_class(self.timestamper, self.coinbaser, data['coinbasevalue'], data['coinbaseaux']['flags'], data['height'], + coinbase = CoinbaseTransactionPOS(self.timestamper, self.coinbaser, data['coinbasevalue'], data['coinbaseaux']['flags'], data['height'], settings.COINBASE_EXTRAS, data['curtime']) self.height = data['height'] diff --git a/lib/coinbasetx.py b/lib/coinbasetx.py index 4f3c187..04cee23 100644 --- a/lib/coinbasetx.py +++ b/lib/coinbasetx.py @@ -6,8 +6,8 @@ import settings import lib.logger log = lib.logger.get_logger('coinbasetx') -if settings.COINDAEMON_Reward == 'POW': - class CoinbaseTransaction(halfnode.CTransaction): +#if settings.COINDAEMON_Reward == 'POW': + class CoinbaseTransactionPOW(halfnode.CTransaction): '''Construct special transaction used for coinbase tx. It also implements quick serialization using pre-cached scriptSig template.''' @@ -17,7 +17,7 @@ if settings.COINDAEMON_Reward == 'POW': extranonce_size = struct.calcsize(extranonce_type) def __init__(self, timestamper, coinbaser, value, flags, height, data): - super(CoinbaseTransaction, self).__init__() + super(CoinbaseTransactionPOW, self).__init__() log.debug("Got to CoinBaseTX") #self.extranonce = 0 @@ -45,7 +45,7 @@ if settings.COINDAEMON_Reward == 'POW': self.vout.append(tx_out) # Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx - self._serialized = super(CoinbaseTransaction, self).serialize().split(self.extranonce_placeholder) + self._serialized = super(CoinbaseTransactionPOW, self).serialize().split(self.extranonce_placeholder) def set_extranonce(self, extranonce): if len(extranonce) != self.extranonce_size: @@ -53,8 +53,8 @@ if settings.COINDAEMON_Reward == 'POW': (part1, part2) = self.vin[0]._scriptSig_template self.vin[0].scriptSig = part1 + extranonce + part2 -elif settings.COINDAEMON_Reward == 'POS': - class CoinbaseTransaction(halfnode.CTransaction): +#elif settings.COINDAEMON_Reward == 'POS': + class CoinbaseTransactionPOS(halfnode.CTransaction): '''Construct special transaction used for coinbase tx. It also implements quick serialization using pre-cached scriptSig template.''' @@ -64,7 +64,7 @@ elif settings.COINDAEMON_Reward == 'POS': extranonce_size = struct.calcsize(extranonce_type) def __init__(self, timestamper, coinbaser, value, flags, height, data, ntime): - super(CoinbaseTransaction, self).__init__() + super(CoinbaseTransactionPOS, self).__init__() log.debug("Got to CoinBaseTX") #self.extranonce = 0 @@ -93,7 +93,7 @@ elif settings.COINDAEMON_Reward == 'POS': self.vout.append(tx_out) # Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx - self._serialized = super(CoinbaseTransaction, self).serialize().split(self.extranonce_placeholder) + self._serialized = super(CoinbaseTransactionPOS, self).serialize().split(self.extranonce_placeholder) def set_extranonce(self, extranonce): if len(extranonce) != self.extranonce_size: @@ -101,7 +101,7 @@ elif settings.COINDAEMON_Reward == 'POS': (part1, part2) = self.vin[0]._scriptSig_template self.vin[0].scriptSig = part1 + extranonce + part2 -else: +#else: class CoinbaseTransaction(halfnode.CTransaction): '''Construct special transaction used for coinbase tx. It also implements quick serialization using pre-cached diff --git a/lib/halfnode.py b/lib/halfnode.py index 2642be1..9975e34 100644 --- a/lib/halfnode.py +++ b/lib/halfnode.py @@ -21,27 +21,27 @@ log = lib.logger.get_logger('halfnode') log.debug("Got to Halfnode") if settings.COINDAEMON_ALGO == 'scrypt': - log.debug("########################################### Loading LTC Scrypt #########################################################") - import ltc_scrypt + log.debug("########################################### Loading LTC Scrypt #########################################################") + import ltc_scrypt elif settings.COINDAEMON_ALGO == 'quark': - log.debug("########################################### Loading Quark Support #########################################################") - import quark_hash + log.debug("########################################### Loading Quark Support #########################################################") + import quark_hash 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_Reward == 'POS': +# log.debug("########################################### Loading POS Support #########################################################") +# pass +#else: +# log.debug("########################################### Loading POW Support ######################################################") +# pass if settings.COINDAEMON_TX == 'yes': - log.debug("########################################### Loading SHA256 Transaction Message Support #########################################################") - pass + log.debug("########################################### Loading SHA256 Transaction Message Support #########################################################") + pass else: - log.debug("########################################### NOT Loading SHA256 Transaction Message Support ######################################################") - pass + log.debug("########################################### NOT Loading SHA256 Transaction Message Support ######################################################") + pass MY_VERSION = 31402 diff --git a/mining/__init__.py b/mining/__init__.py index 110af1b..7a9da20 100644 --- a/mining/__init__.py +++ b/mining/__init__.py @@ -46,15 +46,15 @@ def setup(on_startup): if result['version'] >= 1: result = (yield bitcoin_rpc.getinfo()) if isinstance(result,dict): - if 'stake' in result and settings.COINDAEMON_Reward == 'POS': - log.info("CoinD looks to be a POS Coin, Config for POS looks correct") + if 'stake' in result: # and settings.COINDAEMON_Reward == 'POS': + settings.COINDAEMON_Reward = 'POS' break - elif 'stake' not in result and settings.COINDAEMON_Reward == 'POW': - log.info("CoinD looks to be a POW Coin, Config looks to be correct") + elif 'stake' not in result: # and settings.COINDAEMON_Reward == 'POW': + settings.COINDAEMON_Reward = 'POW' break - else: - log.error("Wrong Algo Selected, Switch to appropriate POS/POW in config.py!") - reactor.stop() +# else: +# log.error("Wrong Algo Selected, Switch to appropriate POS/POW in config.py!") +# reactor.stop() else: log.error("Block Version mismatch: %s" % result['version']) From 8cb3906055dfeac32f6d30c1d1b32e8e482c0148 Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Sun, 19 Jan 2014 08:47:45 -0800 Subject: [PATCH 06/23] fix indent --- lib/coinbasetx.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/coinbasetx.py b/lib/coinbasetx.py index 04cee23..905582b 100644 --- a/lib/coinbasetx.py +++ b/lib/coinbasetx.py @@ -7,7 +7,7 @@ import lib.logger log = lib.logger.get_logger('coinbasetx') #if settings.COINDAEMON_Reward == 'POW': - class CoinbaseTransactionPOW(halfnode.CTransaction): +class CoinbaseTransactionPOW(halfnode.CTransaction): '''Construct special transaction used for coinbase tx. It also implements quick serialization using pre-cached scriptSig template.''' @@ -18,7 +18,7 @@ log = lib.logger.get_logger('coinbasetx') def __init__(self, timestamper, coinbaser, value, flags, height, data): super(CoinbaseTransactionPOW, self).__init__() - log.debug("Got to CoinBaseTX") + log.debug("Got to CoinBaseTX") #self.extranonce = 0 if len(self.extranonce_placeholder) != self.extranonce_size: @@ -54,7 +54,7 @@ log = lib.logger.get_logger('coinbasetx') (part1, part2) = self.vin[0]._scriptSig_template self.vin[0].scriptSig = part1 + extranonce + part2 #elif settings.COINDAEMON_Reward == 'POS': - class CoinbaseTransactionPOS(halfnode.CTransaction): +class CoinbaseTransactionPOS(halfnode.CTransaction): '''Construct special transaction used for coinbase tx. It also implements quick serialization using pre-cached scriptSig template.''' @@ -102,7 +102,7 @@ log = lib.logger.get_logger('coinbasetx') (part1, part2) = self.vin[0]._scriptSig_template self.vin[0].scriptSig = part1 + extranonce + part2 #else: - class CoinbaseTransaction(halfnode.CTransaction): +class CoinbaseTransaction(halfnode.CTransaction): '''Construct special transaction used for coinbase tx. It also implements quick serialization using pre-cached scriptSig template.''' @@ -113,7 +113,7 @@ log = lib.logger.get_logger('coinbasetx') def __init__(self, timestamper, coinbaser, value, flags, height, data, ntime): super(CoinbaseTransaction, self).__init__() - log.debug("Got to CoinBaseTX") + log.debug("Got to CoinBaseTX") #self.extranonce = 0 if len(self.extranonce_placeholder) != self.extranonce_size: From 74d9c2edba2f29f683d669367b0cc24772722f5d Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Sun, 19 Jan 2014 08:50:41 -0800 Subject: [PATCH 07/23] update sample config --- conf/config_sample.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/conf/config_sample.py b/conf/config_sample.py index fd52406..7a6e104 100644 --- a/conf/config_sample.py +++ b/conf/config_sample.py @@ -21,11 +21,8 @@ COINDAEMON_TRUSTED_PASSWORD = 'somepassword' # The available options are: # scrypt, sha256d, scrypt-jane and quark # If the option does not meet either of these criteria stratum defaults to scrypt -# Until AutoReward Selecting Code has been implemented the below options are used to select the type of coin -# For Reward type there is POW and POS. please ensure you choose the currect type. # For Coins which support TX Messages please enter yes in the TX selection COINDAEMON_ALGO = 'scrypt' -COINDAEMON_Reward = 'POW' COINDAEMON_TX = 'no' # ******************** BASIC SETTINGS *************** # Backup Coin Daemon address's (consider having at least 1 backup) From 11054020ddf61c786153f899c5407bde8ff6fae2 Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Sun, 19 Jan 2014 09:13:45 -0800 Subject: [PATCH 08/23] have both script_to_address and script_to_pubkey functions --- lib/util.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/util.py b/lib/util.py index 4a823f7..4e93fec 100644 --- a/lib/util.py +++ b/lib/util.py @@ -211,15 +211,15 @@ def ser_number(n): s.append(n) return bytes(s) -if settings.COINDAEMON_Reward == 'POW': - def script_to_address(addr): - d = address_to_pubkeyhash(addr) - if not d: - raise ValueError('invalid address') - (ver, pubkeyhash) = d - return b'\x76\xa9\x14' + pubkeyhash + b'\x88\xac' -else: - def script_to_pubkey(key): - if len(key) == 66: key = binascii.unhexlify(key) - if len(key) != 33: raise Exception('Invalid Address') - return b'\x21' + key + b'\xac' +#if settings.COINDAEMON_Reward == 'POW': +def script_to_address(addr): + d = address_to_pubkeyhash(addr) + if not d: + raise ValueError('invalid address') + (ver, pubkeyhash) = d + return b'\x76\xa9\x14' + pubkeyhash + b'\x88\xac' +#else: +def script_to_pubkey(key): + if len(key) == 66: key = binascii.unhexlify(key) + if len(key) != 33: raise Exception('Invalid Address') + return b'\x21' + key + b'\xac' From 795ebfa18d09a85e6dec6b4b93fe742f8ae4c688 Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Sun, 19 Jan 2014 10:10:23 -0800 Subject: [PATCH 09/23] change to getdifficulty/proof-of-stake for POW/POS detection --- mining/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mining/__init__.py b/mining/__init__.py index 7a9da20..ae19935 100644 --- a/mining/__init__.py +++ b/mining/__init__.py @@ -44,17 +44,14 @@ def setup(on_startup): if isinstance(result, dict): # litecoind implements version 1 of getblocktemplate if result['version'] >= 1: - result = (yield bitcoin_rpc.getinfo()) + result = (yield bitcoin_rpc.getdifficulty()) if isinstance(result,dict): - if 'stake' in result: # and settings.COINDAEMON_Reward == 'POS': + if 'proof-of-stake' in result: # and settings.COINDAEMON_Reward == 'POS': settings.COINDAEMON_Reward = 'POS' break - elif 'stake' not in result: # and settings.COINDAEMON_Reward == 'POW': + elif 'proof-of-stake' not in result: # and settings.COINDAEMON_Reward == 'POW': settings.COINDAEMON_Reward = 'POW' break -# else: -# log.error("Wrong Algo Selected, Switch to appropriate POS/POW in config.py!") -# reactor.stop() else: log.error("Block Version mismatch: %s" % result['version']) From ff8f4e51fb5cc42a0cf0b3dbea1b78998a7d3f08 Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Sun, 19 Jan 2014 10:12:13 -0800 Subject: [PATCH 10/23] add logging to POW/POS detection --- mining/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mining/__init__.py b/mining/__init__.py index ae19935..64d7956 100644 --- a/mining/__init__.py +++ b/mining/__init__.py @@ -48,9 +48,11 @@ def setup(on_startup): if isinstance(result,dict): if 'proof-of-stake' in result: # and settings.COINDAEMON_Reward == 'POS': settings.COINDAEMON_Reward = 'POS' + log.info("Coin detected as POS") break elif 'proof-of-stake' not in result: # and settings.COINDAEMON_Reward == 'POW': settings.COINDAEMON_Reward = 'POW' + log.info("Coin detected as POW") break else: log.error("Block Version mismatch: %s" % result['version']) From a71d031119398fa4e785a53503fb4f6fa7376e8f Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Sun, 19 Jan 2014 10:14:21 -0800 Subject: [PATCH 11/23] fix indent --- mining/__init__.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mining/__init__.py b/mining/__init__.py index 64d7956..64c6008 100644 --- a/mining/__init__.py +++ b/mining/__init__.py @@ -44,16 +44,16 @@ def setup(on_startup): if isinstance(result, dict): # litecoind implements version 1 of getblocktemplate if result['version'] >= 1: - result = (yield bitcoin_rpc.getdifficulty()) - if isinstance(result,dict): - if 'proof-of-stake' in result: # and settings.COINDAEMON_Reward == 'POS': - settings.COINDAEMON_Reward = 'POS' - log.info("Coin detected as POS") - break - elif 'proof-of-stake' not in result: # and settings.COINDAEMON_Reward == 'POW': - settings.COINDAEMON_Reward = 'POW' - log.info("Coin detected as POW") - break + result = (yield bitcoin_rpc.getdifficulty()) + if isinstance(result,dict): + if 'proof-of-stake' in result: # and settings.COINDAEMON_Reward == 'POS': + settings.COINDAEMON_Reward = 'POS' + log.info("Coin detected as POS") + break + elif 'proof-of-stake' not in result: # and settings.COINDAEMON_Reward == 'POW': + settings.COINDAEMON_Reward = 'POW' + log.info("Coin detected as POW") + break else: log.error("Block Version mismatch: %s" % result['version']) From 113d3322b54a03fdbf5a9a8afc1f41a1579fd33d Mon Sep 17 00:00:00 2001 From: apenner Date: Sun, 19 Jan 2014 10:24:32 -0800 Subject: [PATCH 12/23] Fix for getdifficulty not being an array for POW coins --- mining/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mining/__init__.py b/mining/__init__.py index 64c6008..abb49b9 100644 --- a/mining/__init__.py +++ b/mining/__init__.py @@ -46,14 +46,14 @@ def setup(on_startup): if result['version'] >= 1: result = (yield bitcoin_rpc.getdifficulty()) if isinstance(result,dict): - if 'proof-of-stake' in result: # and settings.COINDAEMON_Reward == 'POS': + if 'proof-of-stake' in result: settings.COINDAEMON_Reward = 'POS' log.info("Coin detected as POS") - break - elif 'proof-of-stake' not in result: # and settings.COINDAEMON_Reward == 'POW': - settings.COINDAEMON_Reward = 'POW' - log.info("Coin detected as POW") - break + break; + else: + settings.COINDAEMON_Reward = 'POW' + log.info("Coin detected as POW") + break; else: log.error("Block Version mismatch: %s" % result['version']) From 4a81edfb430ca6c919063995e5a6d969d36e2920 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:18:49 +0000 Subject: [PATCH 13/23] Create requirements.txt --- requirements.txt | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3aad2ca --- /dev/null +++ b/requirements.txt @@ -0,0 +1,48 @@ +# This File is used to create a list of requirements needed for testing stratum-mining or to create a clone install +BeautifulSoup==3.2.1 +Brlapi==0.5.7 +GnuPGInterface==0.3.2 +MySQL-python==1.2.3 +PAM==0.4.2 +Pyste==0.9.10 +SOAPpy==0.12.0 +Twisted==12.0.0 +Twisted-Conch==12.0.0 +Twisted-Core==12.0.0 +Twisted-Lore==12.0.0 +Twisted-Mail==12.0.0 +Twisted-Names==12.0.0 +Twisted-News==12.0.0 +Twisted-Runner==12.0.0 +Twisted-Web==12.0.0 +Twisted-Words==12.0.0 +apt-xapian-index==0.45 +argparse==1.2.1 +autobahn==0.6.5 +chardet==2.0.1 +defer==1.0.6 +distribute==0.6.28 +ecdsa==0.10 +feedparser==5.1.2 +fpconst==0.7.2 +httplib2==0.7.4 +louis==2.4.1 +ltc-scrypt==1.0 +numpy==1.6.2 +pyOpenSSL==0.13 +pyasn1==0.1.3 +pycrypto==2.6 +pycurl==7.19.0 +pyserial==2.5 +python-apt==0.8.8.2 +python-debian==0.1.21 +python-debianbts==1.11 +python-memcached==1.48 +pyxdg==0.19 +reportbug==6.4.4 +simplejson==2.5.2 +stratum==0.2.13 +uTidylib==0.2 +unattended-upgrades==0.1 +wsgiref==0.1.2 +zope.interface==3.6.1 From 7b73fa597ce6b955d36ed162deaff39cc2eef7b0 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:20:35 +0000 Subject: [PATCH 14/23] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3aad2ca..ada1c0f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # This File is used to create a list of requirements needed for testing stratum-mining or to create a clone install BeautifulSoup==3.2.1 -Brlapi==0.5.7 +#Brlapi==0.5.7 GnuPGInterface==0.3.2 MySQL-python==1.2.3 PAM==0.4.2 From 8f8ab613e9260d6ca44988d9efa476eef45b884c Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:22:04 +0000 Subject: [PATCH 15/23] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ada1c0f..36c4472 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ # This File is used to create a list of requirements needed for testing stratum-mining or to create a clone install BeautifulSoup==3.2.1 #Brlapi==0.5.7 -GnuPGInterface==0.3.2 +#GnuPGInterface==0.3.2 MySQL-python==1.2.3 PAM==0.4.2 Pyste==0.9.10 From de133cd1304292aeacd5b513729fc85aa4064007 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:24:38 +0000 Subject: [PATCH 16/23] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 36c4472..0eaebb5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ BeautifulSoup==3.2.1 #Brlapi==0.5.7 #GnuPGInterface==0.3.2 MySQL-python==1.2.3 -PAM==0.4.2 +#PAM==0.4.2 Pyste==0.9.10 SOAPpy==0.12.0 Twisted==12.0.0 From 7fa777b149d42876d45a83f015486b8dd8c3fda3 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:26:04 +0000 Subject: [PATCH 17/23] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0eaebb5..c0dfe8b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ BeautifulSoup==3.2.1 #GnuPGInterface==0.3.2 MySQL-python==1.2.3 #PAM==0.4.2 -Pyste==0.9.10 +#Pyste==0.9.10 SOAPpy==0.12.0 Twisted==12.0.0 Twisted-Conch==12.0.0 From 364d2201c2d08529128b695dcd2611305dce4ead Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:27:41 +0000 Subject: [PATCH 18/23] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c0dfe8b..6d5d3e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ BeautifulSoup==3.2.1 MySQL-python==1.2.3 #PAM==0.4.2 #Pyste==0.9.10 -SOAPpy==0.12.0 +#SOAPpy==0.12.0 Twisted==12.0.0 Twisted-Conch==12.0.0 Twisted-Core==12.0.0 From 735d5192d813d59c5d252fe2f64ef3b9c024f9f9 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:29:43 +0000 Subject: [PATCH 19/23] Update requirements.txt --- requirements.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6d5d3e5..61612e1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,16 +7,16 @@ MySQL-python==1.2.3 #Pyste==0.9.10 #SOAPpy==0.12.0 Twisted==12.0.0 -Twisted-Conch==12.0.0 -Twisted-Core==12.0.0 -Twisted-Lore==12.0.0 -Twisted-Mail==12.0.0 -Twisted-Names==12.0.0 -Twisted-News==12.0.0 -Twisted-Runner==12.0.0 -Twisted-Web==12.0.0 -Twisted-Words==12.0.0 -apt-xapian-index==0.45 +#Twisted-Conch==12.0.0 +#Twisted-Core==12.0.0 +#Twisted-Lore==12.0.0 +#Twisted-Mail==12.0.0 +#Twisted-Names==12.0.0 +#Twisted-News==12.0.0 +#Twisted-Runner==12.0.0 +#Twisted-Web==12.0.0 +#Twisted-Words==12.0.0 +#apt-xapian-index==0.45 argparse==1.2.1 autobahn==0.6.5 chardet==2.0.1 @@ -27,7 +27,7 @@ feedparser==5.1.2 fpconst==0.7.2 httplib2==0.7.4 louis==2.4.1 -ltc-scrypt==1.0 +#ltc-scrypt==1.0 numpy==1.6.2 pyOpenSSL==0.13 pyasn1==0.1.3 @@ -41,7 +41,7 @@ python-memcached==1.48 pyxdg==0.19 reportbug==6.4.4 simplejson==2.5.2 -stratum==0.2.13 +#stratum==0.2.13 uTidylib==0.2 unattended-upgrades==0.1 wsgiref==0.1.2 From 6d1c887a1013521d0cc1d79fdf82672a67d151c1 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:30:39 +0000 Subject: [PATCH 20/23] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 61612e1..b48fd2a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,7 @@ Twisted==12.0.0 #apt-xapian-index==0.45 argparse==1.2.1 autobahn==0.6.5 -chardet==2.0.1 +#chardet==2.0.1 defer==1.0.6 distribute==0.6.28 ecdsa==0.10 From 5b4859769363930426b217c03b67f7c9ca65e139 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:31:57 +0000 Subject: [PATCH 21/23] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b48fd2a..e540c8c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,7 +26,7 @@ ecdsa==0.10 feedparser==5.1.2 fpconst==0.7.2 httplib2==0.7.4 -louis==2.4.1 +#louis==2.4.1 #ltc-scrypt==1.0 numpy==1.6.2 pyOpenSSL==0.13 From 073d713c04b09a1c99da15fd033ed3789bc69de7 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:33:01 +0000 Subject: [PATCH 22/23] Update requirements.txt --- requirements.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/requirements.txt b/requirements.txt index e540c8c..ea4e689 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,21 +28,21 @@ fpconst==0.7.2 httplib2==0.7.4 #louis==2.4.1 #ltc-scrypt==1.0 -numpy==1.6.2 +#numpy==1.6.2 pyOpenSSL==0.13 pyasn1==0.1.3 pycrypto==2.6 -pycurl==7.19.0 +#pycurl==7.19.0 pyserial==2.5 -python-apt==0.8.8.2 -python-debian==0.1.21 -python-debianbts==1.11 +#python-apt==0.8.8.2 +#python-debian==0.1.21 +#python-debianbts==1.11 python-memcached==1.48 pyxdg==0.19 reportbug==6.4.4 simplejson==2.5.2 #stratum==0.2.13 -uTidylib==0.2 -unattended-upgrades==0.1 -wsgiref==0.1.2 +#uTidylib==0.2 +#unattended-upgrades==0.1 +#wsgiref==0.1.2 zope.interface==3.6.1 From 1723cdd188ba8551635e200f637d5677101f9014 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Mon, 20 Jan 2014 15:34:28 +0000 Subject: [PATCH 23/23] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ea4e689..02bf93f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -39,7 +39,7 @@ pyserial==2.5 #python-debianbts==1.11 python-memcached==1.48 pyxdg==0.19 -reportbug==6.4.4 +#reportbug==6.4.4 simplejson==2.5.2 #stratum==0.2.13 #uTidylib==0.2