@deferral.DeferredCacher
@defer.inlineCallbacks
def height_cacher(block_hash):
- x = yield bitcoind.rpc_getblock('%x' % (block_hash,))
+ try:
+ x = yield bitcoind.rpc_getblock('%x' % (block_hash,))
+ except jsonrpc.Error, e:
+ if e.code == -5 and not p2pool.DEBUG:
+ raise deferral.RetrySilentlyException()
+ raise
defer.returnValue(x['blockcount'] if 'blockcount' in x else x['height'])
best_height_cached = variable.Variable((yield deferral.retry()(height_cacher)(pre_current_work.value['previous_block'])))
def get_height_rel_highest(block_hash):
self.waiting.pop(key).callback(None)
def eb(fail):
self.waiting.pop(key).callback(None)
+ if fail.check(RetrySilentlyException):
+ return
print
print 'Error when requesting noncached value:'
fail.printTraceback()