mirror of
https://github.com/0glabs/0g-chain.git
synced 2025-04-04 15:55:23 +00:00
maintain counter before clean cache
This commit is contained in:
parent
18d4e1b538
commit
a1b0c2188e
@ -450,6 +450,14 @@ func (mp *PriorityNonceMempool) Remove(tx sdk.Tx) error {
|
|||||||
nonce = sig.Sequence
|
nonce = sig.Sequence
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, exists := mp.counterBySender[sender]; exists {
|
||||||
|
if mp.counterBySender[sender] > 1 {
|
||||||
|
mp.counterBySender[sender] -= 1
|
||||||
|
} else {
|
||||||
|
delete(mp.counterBySender, sender)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scoreKey := txMeta{nonce: nonce, sender: sender}
|
scoreKey := txMeta{nonce: nonce, sender: sender}
|
||||||
score, ok := mp.scores[scoreKey]
|
score, ok := mp.scores[scoreKey]
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -467,14 +475,6 @@ func (mp *PriorityNonceMempool) Remove(tx sdk.Tx) error {
|
|||||||
delete(mp.scores, scoreKey)
|
delete(mp.scores, scoreKey)
|
||||||
mp.priorityCounts[score.priority]--
|
mp.priorityCounts[score.priority]--
|
||||||
|
|
||||||
if _, exists := mp.counterBySender[sender]; exists {
|
|
||||||
if mp.counterBySender[sender] > 1 {
|
|
||||||
mp.counterBySender[sender] -= 1
|
|
||||||
} else {
|
|
||||||
delete(mp.counterBySender, sender)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user