Replace getwork call with getblocktemplate
This commit is contained in:
parent
a19ae3444a
commit
76077630aa
@ -141,12 +141,16 @@ class BitcoinRPC(object):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def prevhash(self):
|
def prevhash(self):
|
||||||
resp = (yield self._call('getwork', []))
|
|
||||||
try:
|
try:
|
||||||
defer.returnValue(json.loads(resp)['result']['data'][8:72])
|
resp = (yield self._call('getblocktemplate', [{}]))
|
||||||
|
defer.returnValue(json.loads(resp)['result']['previousblockhash'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception("Cannot decode prevhash %s" % str(e))
|
if (str(e) == "500 Internal Server Error"):
|
||||||
raise
|
resp = (yield self._call('getblocktemplate', []))
|
||||||
|
defer.returnValue(json.loads(resp)['result']['previousblockhash'])
|
||||||
|
else:
|
||||||
|
log.exception("Cannot decode prevhash %s" % str(e))
|
||||||
|
raise
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def validateaddress(self, address):
|
def validateaddress(self, address):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user