From 2db9f169861afe197176676eda90a66cf3cec751 Mon Sep 17 00:00:00 2001 From: forrest Date: Tue, 12 Jul 2011 12:35:56 +0000 Subject: [PATCH] bug git-svn-id: svn://forre.st/p2pool@1380 470744a7-cac9-478e-843e-5ec1b25c69e8 --- p2pool/bitcoin/p2p.py | 2 +- p2pool/data.py | 2 +- p2pool/main.py | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/p2pool/bitcoin/p2p.py b/p2pool/bitcoin/p2p.py index d48fdf7..736ce41 100644 --- a/p2pool/bitcoin/p2p.py +++ b/p2pool/bitcoin/p2p.py @@ -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), diff --git a/p2pool/data.py b/p2pool/data.py index 55a3a66..aa475c6 100644 --- a/p2pool/data.py +++ b/p2pool/data.py @@ -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 diff --git a/p2pool/main.py b/p2pool/main.py index a898d20..6974d48 100644 --- a/p2pool/main.py +++ b/p2pool/main.py @@ -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): -- 1.7.1