include many collected bootstrap addresses in network definitions. litecoin ones...
authorForrest Voight <forrest.voight@gmail.com>
Thu, 5 Jan 2012 10:33:06 +0000 (05:33 -0500)
committerForrest Voight <forrest.voight@gmail.com>
Thu, 5 Jan 2012 10:33:06 +0000 (05:33 -0500)
p2pool/main.py
p2pool/networks.py

index 03789de..150abb6 100644 (file)
@@ -299,27 +299,12 @@ def main(args, net, datadir_path):
             else:
                 return x, net.P2P_PORT
         
-        nodes = set([
-            ('72.14.191.28', net.P2P_PORT),
-            ('62.204.197.159', net.P2P_PORT),
-            ('142.58.248.28', net.P2P_PORT),
-            ('94.23.34.145', net.P2P_PORT),
-        ])
-        for host in [
-            'p2pool.forre.st',
-            'dabuttonfactory.com',
-            ] + (['liteco.in'] if net.NAME == 'litecoin' else []) + [
-        ]:
+        addrs = dict((parse(addr), (0, 0, 0)) for addr in net.BOOTSTRAP_ADDRS)
+        if os.path.exists(os.path.join(datadir_path, 'addrs.txt')):
             try:
-                nodes.add(((yield reactor.resolve(host)), net.P2P_PORT))
+                addrs.update(dict(eval(x) for x in open(os.path.join(datadir_path, 'addrs.txt'))))
             except:
-                log.err(None, 'Error resolving bootstrap node IP:')
-        
-        addrs = {}
-        try:
-            addrs = dict(eval(x) for x in open(os.path.join(datadir_path, 'addrs.txt')))
-        except:
-            print >>sys.stderr, "error reading addrs"
+                print >>sys.stderr, "error reading addrs"
         
         def save_addrs():
             open(os.path.join(datadir_path, 'addrs.txt'), 'w').writelines(repr(x) + '\n' for x in addrs.iteritems())
@@ -330,7 +315,7 @@ def main(args, net, datadir_path):
             port=args.p2pool_port,
             net=net,
             addr_store=addrs,
-            preferred_addrs=set(map(parse, args.p2pool_nodes)) | nodes,
+            preferred_addrs=set(map(parse, args.p2pool_nodes)),
         )
         p2p_node.handle_shares = p2p_shares
         p2p_node.handle_share_hashes = p2p_share_hashes
index 4efa8cb..92e7b39 100644 (file)
@@ -21,6 +21,7 @@ BitcoinMainnet = math.Object(
     MAX_TARGET=2**256//2**32 - 1,
     PERSIST=True,
     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 89.78.212.44 94.23.34.145 168.7.116.243 72.14.191.28 94.174.40.189:9344'.split(' '),
 )
 BitcoinTestnet = math.Object(
     PARENT=networks.BitcoinTestnet,
@@ -36,6 +37,7 @@ BitcoinTestnet = math.Object(
     MAX_TARGET=2**256//2**32 - 1,
     PERSIST=False,
     WORKER_PORT=19332,
+    BOOTSTRAP_ADDRS='72.14.191.28'.split(' '),
 )
 
 NamecoinMainnet = math.Object(
@@ -52,6 +54,7 @@ NamecoinMainnet = math.Object(
     MAX_TARGET=2**256//2**32 - 1,
     PERSIST=True,
     WORKER_PORT=9331,
+    BOOTSTRAP_ADDRS='72.14.191.28'.split(' '),
 )
 NamecoinTestnet = math.Object(
     PARENT=networks.NamecoinTestnet,
@@ -67,6 +70,7 @@ NamecoinTestnet = math.Object(
     MAX_TARGET=2**256//2**32 - 1,
     PERSIST=False,
     WORKER_PORT=19331,
+    BOOTSTRAP_ADDRS='72.14.191.28'.split(' '),
 )
 
 LitecoinMainnet = math.Object(
@@ -83,6 +87,7 @@ LitecoinMainnet = math.Object(
     MAX_TARGET=2**256//2**20 - 1,
     PERSIST=True,
     WORKER_PORT=9327,
+    BOOTSTRAP_ADDRS='72.14.191.28 176.31.249.89'.split(' ')
 )
 LitecoinTestnet = math.Object(
     PARENT=networks.LitecoinTestnet,
@@ -98,6 +103,7 @@ LitecoinTestnet = math.Object(
     MAX_TARGET=2**256//2**17 - 1,
     PERSIST=False,
     WORKER_PORT=19327,
+    BOOTSTRAP_ADDRS='72.14.191.28 176.31.249.89'.split(' ')
 )
 
 nets=dict((net.NAME, net) for net in set([BitcoinMainnet, BitcoinTestnet, NamecoinMainnet, NamecoinTestnet, LitecoinMainnet, LitecoinTestnet]))