tredo verifications if a header verification fails - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 2307323bb7b254aff3512336b17872af9fc53e6e DIR parent 81520729381241648e47933b37211d1238c338c1 HTML Author: thomasv <thomasv@gitorious> Date: Sat, 27 Oct 2012 16:56:04 +0200 redo verifications if a header verification fails Diffstat: M lib/verifier.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- DIR diff --git a/lib/verifier.py b/lib/verifier.py t@@ -208,8 +208,13 @@ class WalletVerifier(threading.Thread): assert bits == header.get('bits') assert eval('0x'+_hash) < target except: + # this can be caused by a reorg. print_error("verify header failed"+ repr(header)) - # this can be caused by a reorg. + # undo verifications + for tx_hash, tx_height in self.verified_tx.items(): + if tx_height >= height: + print "redoing", tx_hash + self.verified_tx.pop(tx_hash) # return False to request previous header. return False t@@ -269,7 +274,6 @@ class WalletVerifier(threading.Thread): self.set_local_height() def save_header(self, header): - # todo: invalidate tx verifications if we rewind data = self.header_to_string(header).decode('hex') assert len(data) == 80 height = header.get('block_height')