electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 18c9c2f3696e02381fd7d2e7cc38c21896173cca
parent be6aab538d76191fd849787a58ea40f24c5b7776
Author: ThomasV <thomasv@gitorious>
Date:   Sat, 27 Oct 2012 13:02:59 +0200

request headers chunk if we need more than 50 blocks

Diffstat:
Mlib/verifier.py | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/verifier.py b/lib/verifier.py @@ -66,15 +66,16 @@ class WalletVerifier(threading.Thread): while True: # request missing chunks - max_index = (self.height+1)/2016 if not all_chunks and self.height and not requested_chunks: - for i in range(0, max_index + 1): - # test if we can read the first header of the chunk - if self.read_header(i*2016): continue - # print "requesting chunk", i - self.interface.send([ ('blockchain.block.get_chunk',[i])], 'verifier') - requested_chunks.append(i) - break + + if self.local_height + 50 < self.height: + min_index = (self.local_height + 1)/2016 + max_index = (self.height + 1)/2016 + for i in range(min_index, max_index + 1): + # print "requesting chunk", i + self.interface.send([ ('blockchain.block.get_chunk',[i])], 'verifier') + requested_chunks.append(i) + break else: all_chunks = True print_error("downloaded all chunks")