1
0

verifier: fix a race during reorgs

related: 41e088693d
If our guess of a txn getting confirmed at the same height in the new chain
as it was at in the old chain is incorrect, there is a race between the
verifier and the synchronizer. If the verifier wins, the exception will cause
us to disconnect.
This commit is contained in:
SomberNight
2018-09-17 03:35:25 +02:00
parent dcab22dcc7
commit aee2d8e120
3 changed files with 19 additions and 6 deletions

View File

@@ -575,6 +575,12 @@ class AddressSynchronizer(PrintError):
if self.verifier:
self.verifier.remove_spv_proof_for_tx(tx_hash)
def remove_unverified_tx(self, tx_hash, tx_height):
with self.lock:
new_height = self.unverified_tx.get(tx_hash)
if new_height == tx_height:
self.unverified_tx.pop(tx_hash, None)
def add_verified_tx(self, tx_hash: str, info: VerifiedTxInfo):
# Remove from the unverified map and add to the verified map
with self.lock: