Revert "added miner timestamp rolling check"
authorForrest Voight <forrest.voight@gmail.com>
Fri, 13 Jul 2012 16:59:29 +0000 (12:59 -0400)
committerForrest Voight <forrest.voight@gmail.com>
Fri, 13 Jul 2012 16:59:29 +0000 (12:59 -0400)
This reverts commit fc4ae93a433d125828929afb9f1eeb1e7dd153dc.

p2pool/bitcoin/worker_interface.py

index e4c8a20..7bd0f4a 100644 (file)
@@ -43,7 +43,7 @@ class WorkerInterface(object):
         self.work_cache = {}
         self.work_cache_times = self.worker_bridge.new_work_event.times
         
-        self.merkle_roots = expiring_dict.ExpiringDict(300)
+        self.merkle_root_to_handler = expiring_dict.ExpiringDict(300)
     
     def attach_to(self, res, get_handler=None):
         res.putChild('', _GETableServer(_Provider(self, long_poll=False), get_handler))
@@ -62,14 +62,10 @@ class WorkerInterface(object):
         
         if data is not None:
             header = getwork.decode_data(data)
-            if header['merkle_root'] not in self.merkle_roots:
+            if header['merkle_root'] not in self.merkle_root_to_handler:
                 print >>sys.stderr, '''Couldn't link returned work's merkle root with its handler. This should only happen if this process was recently restarted!'''
                 defer.returnValue(False)
-            handler, orig_timestamp = self.merkle_roots[header['merkle_root']]
-            dt = header['timestamp'] - orig_timestamp
-            if dt < 0 or dt % 12 == 11 or dt >= 600:
-                print >>sys.stderr, '''Miner %s @ %s rolled timestamp improperly! This may be a bug in the miner that is causing you to lose work!''' % (request.getUser(), request.getClientIP())
-            defer.returnValue(handler(header, request))
+            defer.returnValue(self.merkle_root_to_handler[header['merkle_root']](header, request))
         
         if p2pool.DEBUG:
             id = random.randrange(1000, 10000)
@@ -96,10 +92,10 @@ class WorkerInterface(object):
             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_roots
+            assert res.merkle_root not in self.merkle_root_to_handler
             orig_timestamp = res.timestamp
         
-        self.merkle_roots[res.merkle_root] = handler, orig_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, handler