sanitize pass_checkpoint
This commit is contained in:
parent
d371e1c807
commit
1b14a18b1a
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue