sanitize pass_checkpoint

This commit is contained in:
ThomasV 2017-03-30 05:55:02 +02:00
parent d371e1c807
commit 1b14a18b1a
1 changed files with 9 additions and 1 deletions

View File

@ -55,9 +55,17 @@ class Blockchain(util.PrintError):
t.start()
def pass_checkpoint(self, header):
if type(header) is not dict:
return False
if header.get('block_height') != self.checkpoint_height:
return True
return self.hash_header(header) == self.checkpoint_hash
if header.get('prev_block_hash') is None:
header['prev_block_hash'] = '00'*32
try:
_hash = self.hash_header(header)
except:
return False
return _hash == self.checkpoint_hash
def verify_header(self, header, prev_header, bits, target):
prev_hash = self.hash_header(prev_header)