added bitcoin version check to ensure BIP 0034 support
authorForrest Voight <forrest@forre.st>
Sun, 26 Aug 2012 22:15:52 +0000 (18:15 -0400)
committerForrest Voight <forrest@forre.st>
Sun, 26 Aug 2012 22:22:00 +0000 (18:22 -0400)
p2pool/main.py
p2pool/networks.py

index cb69c16..7c819b7 100644 (file)
@@ -78,12 +78,11 @@ def main(args, net, datadir_path, merged_urls, worker_endpoint):
             if not (yield net.PARENT.RPC_CHECK(bitcoind)):
                 print >>sys.stderr, "    Check failed! Make sure that you're connected to the right bitcoind with --bitcoind-rpc-port!"
                 raise deferral.RetrySilentlyException()
-            temp_work = yield getwork(bitcoind)
-            if not net.VERSION_CHECK((yield bitcoind.rpc_getinfo())['version'], temp_work):
-                print >>sys.stderr, '    Bitcoin version too old! BIP16 support required! Upgrade to 0.6.0rc4 or greater!'
+            if not net.VERSION_CHECK((yield bitcoind.rpc_getinfo())['version']):
+                print >>sys.stderr, '    Bitcoin version too old! Upgrade to 0.6.4 or newer!'
                 raise deferral.RetrySilentlyException()
-            defer.returnValue(temp_work)
-        temp_work = yield check()
+        yield check()
+        temp_work = yield getwork(bitcoind)
         
         block_height_var = variable.Variable(None)
         @defer.inlineCallbacks
index 89d3ae8..3b91c92 100644 (file)
@@ -23,7 +23,7 @@ nets = dict(
         WORKER_PORT=9332,
         BOOTSTRAP_ADDRS='74.220.242.6:9334 93.97.192.93 66.90.73.83 67.83.108.0 219.84.64.174 24.167.17.248 109.74.195.142 83.211.86.49 94.23.34.145 168.7.116.243 72.14.191.28 94.174.40.189:9344 89.79.79.195 portals94.ns01.us'.split(' '),
         ANNOUNCE_CHANNEL='#p2pool',
-        VERSION_CHECK=lambda v, temp_work: 50400 <= v < 60000 or 60003 <= v or '/P2SH/' in temp_work['coinbaseflags'],
+        VERSION_CHECK=lambda v: 50700 <= v < 60000 or 60010 <= v < 60100 or 60400 <= v,
     ),
     bitcoin_testnet=math.Object(
         PARENT=networks.nets['bitcoin_testnet'],
@@ -40,7 +40,7 @@ nets = dict(
         WORKER_PORT=19332,
         BOOTSTRAP_ADDRS='72.14.191.28 liteco.in'.split(' '),
         ANNOUNCE_CHANNEL='#p2pool-alt',
-        VERSION_CHECK=lambda v, temp_work: 50400 <= v < 60000 or 60003 <= v or '/P2SH/' in temp_work['coinbaseflags'],
+        VERSION_CHECK=lambda v: 50700 <= v < 60000 or 60010 <= v < 60100 or 60400 <= v,
     ),
     
     litecoin=math.Object(
@@ -58,7 +58,7 @@ nets = dict(
         WORKER_PORT=9327,
         BOOTSTRAP_ADDRS='forre.st 178.33.28.54 219.84.64.174 190.195.79.161 83.104.131.111'.split(' '),
         ANNOUNCE_CHANNEL='#p2pool-alt',
-        VERSION_CHECK=lambda v, temp_work: True,
+        VERSION_CHECK=lambda v: True,
     ),
     litecoin_testnet=math.Object(
         PARENT=networks.nets['litecoin_testnet'],
@@ -75,7 +75,7 @@ nets = dict(
         WORKER_PORT=19327,
         BOOTSTRAP_ADDRS='72.14.191.28'.split(' '),
         ANNOUNCE_CHANNEL='#p2pool-alt',
-        VERSION_CHECK=lambda v, temp_work: True,
+        VERSION_CHECK=lambda v: True,
     ),
 )
 for net_name, net in nets.iteritems():