diff --git a/lib/bitcoin_rpc.py b/lib/bitcoin_rpc.py index 43a6a55..701f28e 100644 --- a/lib/bitcoin_rpc.py +++ b/lib/bitcoin_rpc.py @@ -70,8 +70,16 @@ 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']) + else: + raise @defer.inlineCallbacks def prevhash(self):