From 16607d14e7a45e94bb29b3381c21de298d9b91de Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Fri, 27 Aug 2021 17:15:49 +0700 Subject: [PATCH] add state check assert routine --- txpool/pool.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/txpool/pool.go b/txpool/pool.go index 0adfeb7de..f204c7c2a 100644 --- a/txpool/pool.go +++ b/txpool/pool.go @@ -976,6 +976,9 @@ func (p *TxPool) OnNewBlock(stateChanges map[string]senderInfo, unwindTxs, mined return err } defer tx.Rollback() + + p.lock.Lock() + defer p.lock.Unlock() protocolBaseFee, pendingBaseFee = p.setBaseFee(protocolBaseFee, pendingBaseFee) if err := senders.onNewBlock(tx, stateChanges, unwindTxs, minedTxs, blockHeight, blockHash); err != nil { return err @@ -988,8 +991,6 @@ func (p *TxPool) OnNewBlock(stateChanges map[string]senderInfo, unwindTxs, mined return err } - p.lock.Lock() - defer p.lock.Unlock() if err := onNewBlock(tx, senders, unwindTxs, minedTxs.txs, protocolBaseFee, pendingBaseFee, p.pending, p.baseFee, p.queued, p.txNonce2Tx, p.byHash, p.discardLocked); err != nil { return err }