Skip to content

Commit

Permalink
mutex don't cover GetSigners
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Mar 17, 2024
1 parent e8d5483 commit 934fe0c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions types/mempool/priority_nonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,6 @@ func (mp *PriorityNonceMempool[C]) CountTx() int {
// Remove removes a transaction from the mempool in O(log n) time, returning an
// error if unsuccessful.
func (mp *PriorityNonceMempool[C]) Remove(tx sdk.Tx) error {
mp.mtx.Lock()
defer mp.mtx.Unlock()
sigs, err := mp.cfg.SignerExtractor.GetSigners(tx)
if err != nil {
return err
Expand All @@ -443,6 +441,9 @@ func (mp *PriorityNonceMempool[C]) Remove(tx sdk.Tx) error {
sender := sig.Signer.String()
nonce := sig.Sequence

mp.mtx.Lock()
defer mp.mtx.Unlock()

scoreKey := txMeta[C]{nonce: nonce, sender: sender}
score, ok := mp.scores[scoreKey]
if !ok {
Expand Down

0 comments on commit 934fe0c

Please sign in to comment.