electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 1b14a18b1addbc264800cd6961bdbe02ac3c7d2b
parent d371e1c807f3cf8b0a65d03f470f104baf5416cc
Author: ThomasV <thomasv@electrum.org>
Date:   Thu, 30 Mar 2017 05:55:02 +0200

sanitize pass_checkpoint

Diffstat:
Mlib/blockchain.py | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/blockchain.py b/lib/blockchain.py @@ -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)