tsanitize pass_checkpoint - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 1b14a18b1addbc264800cd6961bdbe02ac3c7d2b DIR parent d371e1c807f3cf8b0a65d03f470f104baf5416cc HTML Author: ThomasV <thomasv@electrum.org> Date: Thu, 30 Mar 2017 05:55:02 +0200 sanitize pass_checkpoint Diffstat: M lib/blockchain.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- DIR diff --git a/lib/blockchain.py b/lib/blockchain.py t@@ -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)