bug
authorforrest <forrest@470744a7-cac9-478e-843e-5ec1b25c69e8>
Tue, 12 Jul 2011 12:35:56 +0000 (12:35 +0000)
committerforrest <forrest@470744a7-cac9-478e-843e-5ec1b25c69e8>
Tue, 12 Jul 2011 12:35:56 +0000 (12:35 +0000)
git-svn-id: svn://forre.st/p2pool@1380 470744a7-cac9-478e-843e-5ec1b25c69e8

p2pool/bitcoin/p2p.py
p2pool/data.py
p2pool/main.py

index d48fdf7..736ce41 100644 (file)
@@ -224,7 +224,7 @@ class Protocol(BaseProtocol):
         ('tx', bitcoin_data.tx_type),
     ])
     def handle_tx(self, tx):
-        self.get_block.got_response(bitcoin_data.tx_type.hash256(tx), tx)
+        self.get_tx.got_response(bitcoin_data.tx_type.hash256(tx), tx)
     
     message_block = bitcoin_data.ComposedType([
         ('block', bitcoin_data.block_type),
index 55a3a66..aa475c6 100644 (file)
@@ -215,7 +215,7 @@ def generate_transaction(tracker, previous_share_hash, new_script, subsidy, nonc
         attempts_per_second = attempts//time
         pre_target = 2**256//(net.SHARE_PERIOD*attempts_per_second) - 1
         pre_target2 = math.clip(pre_target, (previous_share2.target2*9//10, previous_share2.target2*11//10))
-        pre_target3 = math.clip(pre_target2, (0, 2**256//2**16 - 1))
+        pre_target3 = math.clip(pre_target2, (0, 2**256//2**32 - 1))
         target2 = bitcoin_data.FloatingIntegerType().truncate_to(pre_target3)
         print attempts_per_second//1000, "KHASH"
         print "TARGET", 2**256//target2, 2**256/pre_target
index a898d20..6974d48 100644 (file)
@@ -477,9 +477,12 @@ def main(args):
         
         @defer.inlineCallbacks
         def new_tx(tx_hash):
-            assert isinstance(tx_hash, (int, long))
-            tx = yield (yield factory.getProtocol()).get_tx(tx_hash)
-            tx_pool[bitcoin.data.tx_type.hash256(tx)] = Tx(tx, current_work.value['previous_block'])
+            try:
+                assert isinstance(tx_hash, (int, long))
+                tx = yield (yield factory.getProtocol()).get_tx(tx_hash)
+                tx_pool[bitcoin.data.tx_type.hash256(tx)] = Tx(tx, current_work.value['previous_block'])
+            except:
+                traceback.print_exc()
         factory.new_tx.watch(new_tx)
         
         def new_block(block):