Prevent double validation of blocks

This commit is contained in:
Mariano Sorgente
2021-02-07 20:13:01 +09:00
committed by Mariano Sorgente
parent 46de03f4d0
commit d27732d0c3
+3
View File
@@ -840,6 +840,9 @@ class FullNode:
sub_block = dataclasses.replace(sub_block, transactions_generator=unf_block.transactions_generator)
async with self.blockchain.lock:
# After acquiring the lock, check again, because another asyncio thread might have added it
if self.blockchain.contains_sub_block(header_hash):
return None
validation_start = time.time()
# Tries to add the block to the blockchain
pre_validation_results: Optional[