From c5dd0af4ff5d77067fd4c18a680719b08b69358e Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Wed, 15 Jan 2014 10:12:06 +0000 Subject: [PATCH 01/19] Update README.md --- README.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2d50e3e..2d2eee5 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The goal is to make a reliable stratum mining server for scrypt based coins. Ove * Doge: DLtBRYtNCzfiZfcpUeEr8KPvy5k1aR7jca * SRC: sMP2wHN5H2ik7FQDPjhSzFZUWux75BYZGe * ARG: AQvXPWVqGzcpH2j2XSRG7X5R9nA3y9D9aQ - +* CryptsyTradeKey: ec13d183e304326ebd41258d6ae7188e303866fe #Requirements @@ -61,6 +61,7 @@ Other coins have been known to work with this implementation. I have tested with * Franko * Quark * Securecoin +* #Installation The installation of this *stratum-mining* can be found in the Repo Wiki. @@ -68,16 +69,10 @@ The installation of this *stratum-mining* can be found in the Repo Wiki. #Contact I am available in the #MPOS, #crypto-expert, #digitalcoin, and #worldcoin channels on freenode. Although i am willing to provide support through IRC please file issues on the repo. -<<<<<<< HEAD Issues as a direct result of stratum will be helped with as much as possible However issues related to a coin daemon's setup and other non stratum issues, Please research and attempt to debug first. -======= -issues as a direct result of stratum will be helped with as much as possible -However issues related to a coin daemon's setup and other non stratum issues, -Please research and attempt to debug first. - #Credits * Original version by Slush0 (original stratum code) From 4395c31d577525d5c23f9862df6ae66e65112371 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Wed, 15 Jan 2014 10:12:42 +0000 Subject: [PATCH 02/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d2eee5..fb9c736 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Other coins have been known to work with this implementation. I have tested with * Franko * Quark * Securecoin -* + #Installation The installation of this *stratum-mining* can be found in the Repo Wiki. From 6ccaf2f2e60e7819462069853c0030dd03a3bee1 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Fri, 17 Jan 2014 11:52:16 +0000 Subject: [PATCH 03/19] Add Submodule init --- update_submodules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/update_submodules b/update_submodules index a57cd81..3e50b55 100755 --- a/update_submodules +++ b/update_submodules @@ -1,3 +1,4 @@ #!/bin/sh - +git submodule init +git submodule update git submodule foreach git pull origin master From 794936edaae8401feb0b389c9a2b1662bbe1d0b2 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Fri, 17 Jan 2014 11:54:28 +0000 Subject: [PATCH 04/19] Create TODO --- TODO | 1 + 1 file changed, 1 insertion(+) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 0000000..9c4551c --- /dev/null +++ b/TODO @@ -0,0 +1 @@ +1) Flush shares on block find From bf8449ede7e9b21ebdf4551700db9714242b47a5 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Fri, 17 Jan 2014 12:02:29 +0000 Subject: [PATCH 05/19] Update TODO --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index 9c4551c..7c4b1f1 100644 --- a/TODO +++ b/TODO @@ -1 +1,2 @@ 1) Flush shares on block find +2) Add Autoloading of databases From 0f91694037d408db011f578a276947f922934ef5 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Fri, 17 Jan 2014 13:24:02 +0000 Subject: [PATCH 06/19] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index fb9c736..c13087e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +# Automated Testing Information + +![Codeship](https://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status) + #Description Stratum-mining is a pooled mining protocol. It is a replacement for *getwork* based pooling servers by allowing clients to generate work. The stratum protocol is described [here](http://mining.bitcoin.cz/stratum-mining) in full detail. From 0c3153d235ecd7f4494ba90b0e1637b6d7d6b528 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Fri, 17 Jan 2014 13:25:04 +0000 Subject: [PATCH 07/19] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c13087e..9fec34d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# Automated Testing Information -![Codeship](https://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status) #Description Stratum-mining is a pooled mining protocol. It is a replacement for *getwork* based pooling servers by allowing clients to generate work. The stratum protocol is described [here](http://mining.bitcoin.cz/stratum-mining) in full detail. From 7aec15211b5506420b1f0ba3cb51287582194e15 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Fri, 17 Jan 2014 13:30:01 +0000 Subject: [PATCH 08/19] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9fec34d..53809f1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ - - -#Description +https://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status +#Descriptionhttps://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status Stratum-mining is a pooled mining protocol. It is a replacement for *getwork* based pooling servers by allowing clients to generate work. The stratum protocol is described [here](http://mining.bitcoin.cz/stratum-mining) in full detail. This is a implementation of stratum-mining for scrypt based coins. It is compatible with *MPOS* as it complies with the standards of *pushpool*. The end goal is to build on these standards to come up with a more stable solution. From 5cdbe7728068df14c462473c69edfc293675a5a2 Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Fri, 17 Jan 2014 13:31:22 +0000 Subject: [PATCH 09/19] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 53809f1..af13ed4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -https://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status -#Descriptionhttps://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status +[ ![Codeship Status for ahmedbodi/stratum-mining](https://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status?branch=master) +#Description Stratum-mining is a pooled mining protocol. It is a replacement for *getwork* based pooling servers by allowing clients to generate work. The stratum protocol is described [here](http://mining.bitcoin.cz/stratum-mining) in full detail. This is a implementation of stratum-mining for scrypt based coins. It is compatible with *MPOS* as it complies with the standards of *pushpool*. The end goal is to build on these standards to come up with a more stable solution. From dc402f0bbcacdacad7b1a0571852f1e940cd2ddc Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Fri, 17 Jan 2014 13:31:37 +0000 Subject: [PATCH 10/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af13ed4..933cd31 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[ ![Codeship Status for ahmedbodi/stratum-mining](https://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status?branch=master) +[![Codeship Status for ahmedbodi/stratum-mining](https://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status?branch=master) #Description Stratum-mining is a pooled mining protocol. It is a replacement for *getwork* based pooling servers by allowing clients to generate work. The stratum protocol is described [here](http://mining.bitcoin.cz/stratum-mining) in full detail. From f7421df09b34bb75f80cfba61855ff01fcdb54de Mon Sep 17 00:00:00 2001 From: ahmedbodi Date: Fri, 17 Jan 2014 13:38:42 +0000 Subject: [PATCH 11/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 933cd31..cb9410d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Codeship Status for ahmedbodi/stratum-mining](https://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status?branch=master) +[ ![Codeship Status for ahmedbodi/php-mpos](https://www.codeship.io/projects/b3003a70-61a3-0131-231e-26f75a0c690d/status?branch=master)](https://www.codeship.io/projects/12274) #Description Stratum-mining is a pooled mining protocol. It is a replacement for *getwork* based pooling servers by allowing clients to generate work. The stratum protocol is described [here](http://mining.bitcoin.cz/stratum-mining) in full detail. From b68b75d03d4dd7d588ffbfb4b24eecf57643f323 Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Sun, 19 Jan 2014 08:40:47 -0800 Subject: [PATCH 12/19] 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 13/19] 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 14/19] 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 15/19] 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 16/19] 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 17/19] 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 18/19] 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 19/19] 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'])