From a056f9804be9584c7bc22ccef6e29a8dc82ed3c5 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Tue, 25 Aug 2015 14:27:53 +0900 Subject: [PATCH] Notify when a chunk of headers is validated And a couple of cosmetic changes. This should fix #1379. --- lib/network.py | 1 + lib/synchronizer.py | 3 ++- lib/verifier.py | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/network.py b/lib/network.py index 1df55d3e..8263811e 100644 --- a/lib/network.py +++ b/lib/network.py @@ -590,6 +590,7 @@ class Network(util.DaemonThread): # If not finished, get the next chunk if idx < 0 or self.get_local_height() >= data['if_height']: self.bc_requests.popleft() + self.notify('updated') else: self.request_chunk(interface, data, idx) diff --git a/lib/synchronizer.py b/lib/synchronizer.py index 08f96fdc..9a4d9ce1 100644 --- a/lib/synchronizer.py +++ b/lib/synchronizer.py @@ -128,7 +128,8 @@ class WalletSynchronizer(): return self.wallet.receive_tx_callback(tx_hash, tx, tx_height) self.requested_tx.remove((tx_hash, tx_height)) - self.print_error("received tx:", tx_hash, len(tx.raw)) + self.print_error("received tx %s height: %d bytes: %d" % + (tx_hash, tx_height, len(tx.raw))) # callbacks self.network.trigger_callback('new_transaction', (tx,)) if not self.requested_tx: diff --git a/lib/verifier.py b/lib/verifier.py index 35a8a639..28532c5f 100644 --- a/lib/verifier.py +++ b/lib/verifier.py @@ -40,9 +40,9 @@ class SPV(util.DaemonThread): while self.is_running(): unverified = self.wallet.get_unverified_txs() for (tx_hash, tx_height) in unverified: - if self.merkle_roots.get(tx_hash) is None and tx_hash not in requested_merkle: + if tx_hash not in self.merkle_roots and tx_hash not in requested_merkle: if self.network.send([ ('blockchain.transaction.get_merkle',[tx_hash, tx_height]) ], self.queue.put): - self.print_error('requesting merkle', tx_hash) + self.print_error('requested merkle', tx_hash) requested_merkle.add(tx_hash) try: r = self.queue.get(timeout=0.1)