mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
separate truncate_headers for debugging
This commit is contained in:
parent
4cfa513ff1
commit
075dfb5ccb
1 changed files with 5 additions and 2 deletions
|
@ -202,10 +202,13 @@ class Blockchain(util.PrintError):
|
||||||
if self.hash_header(checkpoint) == self.checkpoint_hash:
|
if self.hash_header(checkpoint) == self.checkpoint_hash:
|
||||||
return
|
return
|
||||||
self.print_error('checkpoint mismatch:', self.hash_header(checkpoint), self.checkpoint_hash)
|
self.print_error('checkpoint mismatch:', self.hash_header(checkpoint), self.checkpoint_hash)
|
||||||
self.print_error('Truncating headers file at height %d'%self.checkpoint_height)
|
self.truncate_headers(self.checkpoint_height)
|
||||||
|
|
||||||
|
def truncate_headers(self, height):
|
||||||
|
self.print_error('Truncating headers file at height %d'%height)
|
||||||
name = self.path()
|
name = self.path()
|
||||||
f = open(name, 'rb+')
|
f = open(name, 'rb+')
|
||||||
f.seek(self.checkpoint_height * 80)
|
f.seek(height * 80)
|
||||||
f.truncate()
|
f.truncate()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue