This commit is contained in:
alex.sharov 2021-08-29 13:58:57 +07:00
parent 26328ecfb9
commit 535d7f1a21

View File

@ -997,7 +997,7 @@ func onNewTxs(tx kv.Tx, senders *SendersCache, newTxs TxSlots, protocolBaseFee,
if err != nil {
return err
}
onSenderChange(id, sender, byNonce, protocolBaseFee, pendingBaseFee)
onSenderChange(id, sender, byNonce, protocolBaseFee, pendingBaseFee, discard)
}
pending.EnforceInvariants()
@ -1367,7 +1367,7 @@ func onNewBlock(tx kv.Tx, senders *SendersCache, unwindTxs TxSlots, minedTxs []*
if err != nil {
return err
}
onSenderChange(id, sender, byNonce, protocolBaseFee, pendingBaseFee)
onSenderChange(id, sender, byNonce, protocolBaseFee, pendingBaseFee, discard)
}
pending.EnforceInvariants()
@ -1505,7 +1505,7 @@ func unsafeAddToPendingPool(byNonce *ByNonce, newTxs TxSlots, pending, baseFee,
return changedSenders
}
func onSenderChange(senderID uint64, sender *senderInfo, byNonce *ByNonce, protocolBaseFee, pendingBaseFee uint64) {
func onSenderChange(senderID uint64, sender *senderInfo, byNonce *ByNonce, protocolBaseFee, pendingBaseFee uint64, discard func(*metaTx)) {
if ASSERT && sender == nil {
fmt.Printf("nil sender info: %d\n", senderID)
}
@ -1535,6 +1535,7 @@ func onSenderChange(senderID uint64, sender *senderInfo, byNonce *ByNonce, proto
mt.subPool |= EnoughFeeCapProtocol
} else {
mt.subPool = 0 // TODO: we immediately drop all transactions if they have no first bit - then maybe we don't need this bit at all? And don't add such transactions to queue?
discard(mt)
return true
}