testing
authorforrest <forrest@470744a7-cac9-478e-843e-5ec1b25c69e8>
Thu, 16 Jun 2011 14:19:49 +0000 (14:19 +0000)
committerforrest <forrest@470744a7-cac9-478e-843e-5ec1b25c69e8>
Thu, 16 Jun 2011 14:19:49 +0000 (14:19 +0000)
git-svn-id: svn://forre.st/p2pool@1340 470744a7-cac9-478e-843e-5ec1b25c69e8

p2p.py
p2pool.py

diff --git a/p2p.py b/p2p.py
index 9464e40..7b06891 100644 (file)
--- a/p2p.py
+++ b/p2p.py
@@ -202,9 +202,24 @@ class Protocol(bitcoin_p2p.BaseProtocol):
         pass
     
     def handle_addrme(self, port):
-        self.node.got_addr(('::ffff:' + self.transport.getPeer().host, port), self.other_services, int(time.time()))
-        if random.random() < .7 and self.node.peers:
-            random.choice(self.node.peers.values()).send_addrs(addrs=[dict(address=dict(services=self.other_services, address='::ffff:' + self.transport.getPeer().host, port=port), timestamp=int(time.time()))])
+        host = self.transport.getPeer().host
+        print "addrme from", host, port
+        if host == '127.0.0.1':
+            if random.random() < .7 and self.node.peers:
+                random.choice(self.node.peers.values()).send_addrme(port=port) # services...
+        else:
+            self.node.got_addr(('::ffff:' + self.transport.getPeer().host, port), self.other_services, int(time.time()))
+            if random.random() < .7 and self.node.peers:
+                random.choice(self.node.peers.values()).send_addrs(addrs=[
+                    dict(
+                        address=dict(
+                            services=self.other_services,
+                            address='::ffff:' + host,
+                            port=port,
+                        ),
+                        timestamp=int(time.time()),
+                    ),
+                ])
     def handle_addrs(self, addrs):
         for addr_record in addrs:
             self.node.got_addr((addr_record['address']['address'], addr_record['address']['port']), addr_record['address']['services'], min(int(time.time()), addr_record['timestamp']))
index 7991390..df240be 100644 (file)
--- a/p2pool.py
+++ b/p2pool.py
@@ -165,8 +165,8 @@ def generate_transaction(last_p2pool_block_hash, previous_share2, add_script, su
 # TARGET_MULTIPLIER needs to be less than the current difficulty to prevent miner clients from missing shares
 
 class Testnet(object):
-    TARGET_MULTIPLIER = 30
-    SPREAD = 300
+    TARGET_MULTIPLIER = 3000
+    SPREAD = 3000
     ROOT_BLOCK = 0x3575d1e7b40fe37ad12d41169a1012d26df5f3c35486e2abfbe9d2c
     SCRIPT = '410489175c7658845fd7c33d61029ebf4042e8386443ff6e6628fdb5ac938c31072dc61cee691ae1e8355c3a87cb4813cc9bf036fdb09078d35eacf9e9ab52374ebeac'.decode('hex')
     IDENTIFIER = 0x808330dc87e313b7