|
@ -208,8 +208,13 @@ class WalletVerifier(threading.Thread): |
|
|
assert bits == header.get('bits') |
|
|
assert bits == header.get('bits') |
|
|
assert eval('0x'+_hash) < target |
|
|
assert eval('0x'+_hash) < target |
|
|
except: |
|
|
except: |
|
|
print_error("verify header failed"+ repr(header)) |
|
|
|
|
|
# this can be caused by a reorg. |
|
|
# this can be caused by a reorg. |
|
|
|
|
|
print_error("verify header failed"+ repr(header)) |
|
|
|
|
|
# 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 to request previous header. |
|
|
return False |
|
|
return False |
|
|
|
|
|
|
|
@ -269,7 +274,6 @@ class WalletVerifier(threading.Thread): |
|
|
self.set_local_height() |
|
|
self.set_local_height() |
|
|
|
|
|
|
|
|
def save_header(self, header): |
|
|
def save_header(self, header): |
|
|
# todo: invalidate tx verifications if we rewind |
|
|
|
|
|
data = self.header_to_string(header).decode('hex') |
|
|
data = self.header_to_string(header).decode('hex') |
|
|
assert len(data) == 80 |
|
|
assert len(data) == 80 |
|
|
height = header.get('block_height') |
|
|
height = header.get('block_height') |
|
|