From 1c2d53ce47c9c6575684ebc34824d55db8b38e19 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Fri, 20 Nov 2020 15:47:20 -0800 Subject: [PATCH] Add warning of witness presistence race condition --- trinity/protocol/wit/db.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trinity/protocol/wit/db.py b/trinity/protocol/wit/db.py index f931124783..27cde89623 100644 --- a/trinity/protocol/wit/db.py +++ b/trinity/protocol/wit/db.py @@ -69,6 +69,10 @@ def persist_witness_hashes( recent_blocks_with_witnesses) try: + # Note: if this call is converted to async, watch out for the race + # condition of two persists that interleave. It would be + # possible for one to overwrite the other. For now, the synchronous + # approach means that that isn't a concern. existing_hashes = self.get_witness_hashes(block_hash) except WitnessHashesUnavailable: existing_hashes = ()