From: Forrest Voight Date: Fri, 9 Mar 2012 02:31:03 +0000 (-0500) Subject: hide block not found error when not in debug mode X-Git-Tag: 0.10.0~58 X-Git-Url: https://git.novaco.in/?p=p2pool.git;a=commitdiff_plain;h=07f4128e40c0405c1ca4d74997ceffa7c3a95f37 hide block not found error when not in debug mode --- diff --git a/p2pool/main.py b/p2pool/main.py index 7157777..04aa1c0 100644 --- a/p2pool/main.py +++ b/p2pool/main.py @@ -171,7 +171,12 @@ def main(args, net, datadir_path, merged_urls, worker_endpoint): @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): diff --git a/p2pool/util/deferral.py b/p2pool/util/deferral.py index 101d155..20f5ec8 100644 --- a/p2pool/util/deferral.py +++ b/p2pool/util/deferral.py @@ -162,6 +162,8 @@ class DeferredCacher(object): 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()