mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 08:51:32 +00:00
blockchain: do not load forks that cannot connect to the main headers file
This commit is contained in:
parent
92ebf970ac
commit
de01008992
1 changed files with 5 additions and 2 deletions
|
@ -71,7 +71,11 @@ def read_blockchains(config):
|
||||||
checkpoint = int(filename.split('_')[2])
|
checkpoint = int(filename.split('_')[2])
|
||||||
parent_id = int(filename.split('_')[1])
|
parent_id = int(filename.split('_')[1])
|
||||||
b = Blockchain(config, checkpoint, parent_id)
|
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
|
return blockchains
|
||||||
|
|
||||||
def check_header(header):
|
def check_header(header):
|
||||||
|
@ -318,7 +322,6 @@ class Blockchain(util.PrintError):
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
if prev_hash != header.get('prev_block_hash'):
|
if prev_hash != header.get('prev_block_hash'):
|
||||||
self.print_error("bad hash", height, prev_hash, header.get('prev_block_hash'))
|
|
||||||
return False
|
return False
|
||||||
target = self.get_target(height // 2016 - 1)
|
target = self.get_target(height // 2016 - 1)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Reference in a new issue