From 8c598d1cf2719e66759542d3f0de01cb77f9a562 Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Thu, 30 Jan 2014 16:57:30 -0800 Subject: [PATCH 1/2] fix indent --- lib/bitcoin_rpc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bitcoin_rpc.py b/lib/bitcoin_rpc.py index 7f23839..58035b6 100644 --- a/lib/bitcoin_rpc.py +++ b/lib/bitcoin_rpc.py @@ -117,7 +117,7 @@ class BitcoinRPC(object): if json.loads(resp)['result'] == None: # make sure the block was created. log.info("CHECKING FOR BLOCK AFTER SUBMITBLOCK") - defer.returnValue((yield self.blockexists(hash_hex, scrypt_hex))) + defer.returnValue((yield self.blockexists(hash_hex, scrypt_hex))) else: defer.returnValue(False) From 42d6c47edc2df5dbbbb79ffffc557503a8a3de53 Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Fri, 31 Jan 2014 11:38:17 -0800 Subject: [PATCH 2/2] check shareid before shareid[0] --- mining/DB_Mysql.py | 2 +- mining/DB_Mysql_Vardiff.py | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mining/DB_Mysql.py b/mining/DB_Mysql.py index b25a0ea..7818934 100644 --- a/mining/DB_Mysql.py +++ b/mining/DB_Mysql.py @@ -125,7 +125,7 @@ class DB_Mysql(): shareid = self.dbc.fetchone() - if shareid[0] > 0: + if shareid and shareid[0] > 0: # Note: difficulty = -1 here self.execute( """ diff --git a/mining/DB_Mysql_Vardiff.py b/mining/DB_Mysql_Vardiff.py index be6f49f..7d5f2bc 100644 --- a/mining/DB_Mysql_Vardiff.py +++ b/mining/DB_Mysql_Vardiff.py @@ -83,7 +83,7 @@ class DB_Mysql_Vardiff(DB_Mysql.DB_Mysql): shareid = self.dbc.fetchone() - if shareid[0] > 0: + if shareid and shareid[0] > 0: # Note: difficulty = -1 here self.execute( """ @@ -113,16 +113,15 @@ class DB_Mysql_Vardiff(DB_Mysql.DB_Mysql): %(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] + "time": data[4], + "host": data[6], + "uname": data[0], + "lres": data[5], + "result": data[5], + "reason": data[9], + "solution": data[2] } ) - self.dbh.commit()