From 63cce44bee4321d2f8951a86d852f657f77d7623 Mon Sep 17 00:00:00 2001 From: Alan Penner Date: Sun, 26 Jan 2014 16:10:50 -0800 Subject: [PATCH] fix getblocktemplate for ppcoin. if error passing {} try passing nothing. --- lib/bitcoin_rpc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/bitcoin_rpc.py b/lib/bitcoin_rpc.py index 43a6a55..3d96e8a 100644 --- a/lib/bitcoin_rpc.py +++ b/lib/bitcoin_rpc.py @@ -70,8 +70,14 @@ class BitcoinRPC(object): @defer.inlineCallbacks def getblocktemplate(self): - resp = (yield self._call('getblocktemplate', [{}])) - defer.returnValue(json.loads(resp)['result']) + try: + resp = (yield self._call('getblocktemplate', [{}])) + defer.returnValue(json.loads(resp)['result']) + # if internal server error try getblocktemplate without empty {} # ppcoin + except Exception as e: + if (str(e) == "500 Internal Server Error"): + resp = (yield self._call('getblocktemplate', [])) + defer.returnValue(json.loads(resp)['result']) @defer.inlineCallbacks def prevhash(self):