tblockchain: do not load forks that cannot connect to the main headers file - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit de010089926f152964519b190b47f0f6816d7aa7
DIR parent 92ebf970acb3441f9e78b26d24eb32aa39e95e33
HTML Author: ThomasV <thomasv@electrum.org>
Date: Wed, 13 Dec 2017 13:43:51 +0100
blockchain: do not load forks that cannot connect to the main headers file
Diffstat:
M lib/blockchain.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
DIR diff --git a/lib/blockchain.py b/lib/blockchain.py
t@@ -71,7 +71,11 @@ def read_blockchains(config):
checkpoint = int(filename.split('_')[2])
parent_id = int(filename.split('_')[1])
b = Blockchain(config, checkpoint, parent_id)
- blockchains[b.checkpoint] = b
+ h = b.read_header(b.checkpoint)
+ if b.parent().can_connect(h, check_height=False):
+ blockchains[b.checkpoint] = b
+ else:
+ util.print_error("cannot connect", filename)
return blockchains
def check_header(header):
t@@ -318,7 +322,6 @@ class Blockchain(util.PrintError):
except:
return False
if prev_hash != header.get('prev_block_hash'):
- self.print_error("bad hash", height, prev_hash, header.get('prev_block_hash'))
return False
target = self.get_target(height // 2016 - 1)
try: