From 1fc02168f6a9aa8e01b963f48ae8f39bdcdb6c72 Mon Sep 17 00:00:00 2001 From: Forrest Voight Date: Wed, 7 Mar 2012 00:21:31 -0500 Subject: [PATCH] reinsert work handler in mapping when new work is generated by incrementing timestamp --- p2pool/bitcoin/worker_interface.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/p2pool/bitcoin/worker_interface.py b/p2pool/bitcoin/worker_interface.py index 6a8df25..ea03d1d 100644 --- a/p2pool/bitcoin/worker_interface.py +++ b/p2pool/bitcoin/worker_interface.py @@ -40,7 +40,7 @@ class WorkerInterface(object): self.worker_views = {} - self.work_cache = {} # request_process_func(request) -> blockattempt + self.work_cache = {} self.work_cache_times = self.worker_bridge.new_work_event.times self.merkle_root_to_handler = expiring_dict.ExpiringDict(300) @@ -84,15 +84,16 @@ class WorkerInterface(object): self.work_cache_times = self.worker_bridge.new_work_event.times if key in self.work_cache: - res, orig_timestamp = self.work_cache.pop(key) + res, orig_timestamp, handler = self.work_cache.pop(key) else: res, handler = self.worker_bridge.get_work(*key) assert res.merkle_root not in self.merkle_root_to_handler - self.merkle_root_to_handler[res.merkle_root] = handler orig_timestamp = res.timestamp + self.merkle_root_to_handler[res.merkle_root] = handler + if res.timestamp + 12 < orig_timestamp + 600: - self.work_cache[key] = res.update(timestamp=res.timestamp + 12), orig_timestamp + self.work_cache[key] = res.update(timestamp=res.timestamp + 12), orig_timestamp, handler if p2pool.DEBUG: print 'POLL %i END identifier=%i' % (id, self.worker_bridge.new_work_event.times) -- 1.7.1