tforce new headers download if file is corrupted - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 5872bd4722eb7058781b1e4767ea619684aa3d16
DIR parent 9ca9b6c397db8543c6edc777bcc2b9d6e25e5839
HTML Author: ThomasV <thomasv@electrum.org>
Date: Thu, 3 Aug 2017 14:25:50 +0200
force new headers download if file is corrupted
Diffstat:
M lib/blockchain.py | 2 +-
M lib/network.py | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
---
DIR diff --git a/lib/blockchain.py b/lib/blockchain.py
t@@ -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']
DIR diff --git a/lib/network.py b/lib/network.py
t@@ -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