debugging submitblock output

This commit is contained in:
Alan Penner 2014-01-22 09:59:10 -08:00 committed by Ahmed Bodiwala
parent b80dae572c
commit cc04405826

View File

@ -154,10 +154,17 @@ class BitcoinRPC(object):
@defer.inlineCallbacks @defer.inlineCallbacks
def blockexists(self, hash_hex): def blockexists(self, hash_hex):
resp = (yield self._call('getblock', [hash_hex,])) log.debug("Checking if the following Block Exists: %s", hash_hex)
if "hash" in json.loads(resp)['result'] and json.loads(resp)['result']['hash'] == hash_hex: try:
log.debug("Block Confirmed: %s" % hash_hex) resp = (yield self._call('getblock', [hash_hex,]))
defer.returnValue(True) log.debug("GETBLOCK RESULT: %s", resp)
else: if "hash" in json.loads(resp)['result'] and json.loads(resp)['result']['hash'] == hash_hex:
log.info("Cannot find block for %s" % hash_hex) log.debug("Block Confirmed: %s" % hash_hex)
defer.returnValue(False) defer.returnValue(True)
else:
log.info("Cannot find block for %s" % hash_hex)
defer.returnValue(False)
except Exception as e:
log.info("Cannot find block for %s" % hash_hex)
defer.returnValue(False)