Fix potential race condition while dropping replaced transactions

Don't discard a transaction if it was eventually collated in the period
between replaced transaction worker initialization and actual dropping.
pull/1917/head
goodsoft 6 years ago committed by pasqu4le
parent d727ab9728
commit e73b727628
No known key found for this signature in database
GPG Key ID: 8F3EE01F1DC90687
  1. 2
      apps/explorer/lib/explorer/chain.ex

@ -2565,7 +2565,7 @@ defmodule Explorer.Chain do
join: duplicate in subquery(query),
on: duplicate.nonce == pending.nonce,
on: duplicate.from_address_hash == pending.from_address_hash,
where: pending.hash in ^hashes
where: pending.hash in ^hashes and is_nil(pending.block_hash)
)
Repo.update_all(transactions_to_update, [set: [error: "dropped/replaced", status: :error]], timeout: timeout)

Loading…
Cancel
Save