electrum

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

commit 5872bd4722eb7058781b1e4767ea619684aa3d16
parent 9ca9b6c397db8543c6edc777bcc2b9d6e25e5839
Author: ThomasV <thomasv@electrum.org>
Date:   Thu,  3 Aug 2017 14:25:50 +0200

force new headers download if file is corrupted

Diffstat:
Mlib/blockchain.py | 2+-
Mlib/network.py | 5+++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/blockchain.py b/lib/blockchain.py @@ -258,7 +258,7 @@ class Blockchain(util.PrintError): return deserialize_header(h, height) def get_hash(self, height): - return bitcoin.GENESIS if height == 0 else hash_header(self.read_header(height)) + return hash_header(self.read_header(height)) def BIP9(self, height, flag): v = self.read_header(height)['version'] diff --git a/lib/network.py b/lib/network.py @@ -946,10 +946,11 @@ class Network(util.DaemonThread): self.process_responses(interface) def init_headers_file(self): - filename = self.blockchains[0].path() - if os.path.exists(filename): + b = self.blockchains[0] + if b.get_hash(0) == bitcoin.GENESIS: self.downloading_headers = False return + filename = b.path() def download_thread(): try: import urllib, socket