From b857895fb9bc2271a6ab7c690df84e3228beeb10 Mon Sep 17 00:00:00 2001 From: Oliver Bundalo Date: Fri, 26 Apr 2024 08:01:15 +0200 Subject: [PATCH] Lock proposed after others queues --- txpool/account.go | 4 ++-- txpool/txpool.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/txpool/account.go b/txpool/account.go index 851e978217..710fee87f6 100644 --- a/txpool/account.go +++ b/txpool/account.go @@ -300,18 +300,18 @@ func (a *account) reset(nonce uint64, promoteCh chan<- promoteRequest) ( prunedPromoted, prunedEnqueued []*types.Transaction, ) { - a.proposed.lock(true) a.promoted.lock(true) a.enqueued.lock(true) + a.proposed.lock(true) a.nonceToTx.lock() a.nonceProposed.lock() defer func() { a.nonceProposed.unlock() a.nonceToTx.unlock() + a.proposed.unlock() a.enqueued.unlock() a.promoted.unlock() - a.proposed.unlock() }() // prune the proposed txs diff --git a/txpool/txpool.go b/txpool/txpool.go index acc89e9647..960c2e95c7 100644 --- a/txpool/txpool.go +++ b/txpool/txpool.go @@ -406,18 +406,18 @@ func (p *TxPool) Drop(tx *types.Transaction) { // signals EventType_DROPPED for provided hash, clears all the slots and metrics // and sets nonce to provided nonce func (p *TxPool) dropAccount(account *account, nextNonce uint64, tx *types.Transaction) { - account.proposed.lock(true) account.promoted.lock(true) account.enqueued.lock(true) + account.proposed.lock(true) account.nonceToTx.lock() account.nonceProposed.lock() defer func() { account.nonceProposed.unlock() account.nonceToTx.unlock() + account.proposed.unlock() account.enqueued.unlock() account.promoted.unlock() - account.proposed.unlock() }() // num of all txs dropped