From bc1c7bd91cc6ca06a6cee6cd61ffc5326dad3451 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 21 Aug 2021 19:09:52 +0700 Subject: [PATCH] save --- txpool/pool.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/txpool/pool.go b/txpool/pool.go index cfa3a82c2..77a2ada89 100644 --- a/txpool/pool.go +++ b/txpool/pool.go @@ -502,7 +502,11 @@ func onNewTxs(senders *SendersCache, newTxs TxSlots, protocolBaseFee, pendingBas } } + changedSenders := map[uint64]*senderInfo{} + unsafeAddToPool(senders, newTxs, pending, PendingSubPool, func(i *metaTx, sender *senderInfo) { + changedSenders[i.Tx.senderID] = sender + if _, ok := localsHistory.Get(i.Tx.idHash); ok { //TODO: also check if sender is in list of local-senders i.subPool |= IsLocal @@ -525,10 +529,9 @@ func onNewTxs(senders *SendersCache, newTxs TxSlots, protocolBaseFee, pendingBas } }) - senders.forEach(func(sender *senderInfo) { - // TODO: aggregate changed senders before call this func + for _, sender := range changedSenders { onSenderChange(sender, protocolBaseFee, pendingBaseFee) - }) + } pending.EnforceInvariants() baseFee.EnforceInvariants()