Browse Source

Fix rare race condition

Closes #567
patch-2
Neil Booth 7 years ago
parent
commit
afae1b4a42
  1. 6
      electrumx/server/session.py

6
electrumx/server/session.py

@ -670,8 +670,10 @@ class ElectrumX(SessionBase):
# Check mempool hashXs - the status is a function of the # Check mempool hashXs - the status is a function of the
# confirmed state of other transactions. Note: we cannot # confirmed state of other transactions. Note: we cannot
# iterate over mempool_statuses as it changes size. # iterate over mempool_statuses as it changes size.
for hashX in set(self.mempool_statuses): for hashX in tuple(self.mempool_statuses):
old_status = self.mempool_statuses[hashX] # Items can be evicted whilst await-ing below; False
# ensures such hashXs are notified
old_status = self.mempool_statuses.get(hashX, False)
status = await self.address_status(hashX) status = await self.address_status(hashX)
if status != old_status: if status != old_status:
alias = self.hashX_subs[hashX] alias = self.hashX_subs[hashX]

Loading…
Cancel
Save