mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-27 18:29:26 +00:00
core/txpool/blobpool: simplify rolling eviction field calculation
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
67ee431474
commit
4d532c2edc
1 changed files with 6 additions and 13 deletions
|
|
@ -1576,7 +1576,7 @@ func (p *BlobPool) addLocked(tx *types.Transaction, checkGapped bool) (err error
|
||||||
meta.evictionExecTip = meta.execTipCap
|
meta.evictionExecTip = meta.execTipCap
|
||||||
meta.evictionExecFeeJumps = meta.basefeeJumps
|
meta.evictionExecFeeJumps = meta.basefeeJumps
|
||||||
meta.evictionBlobFeeJumps = meta.blobfeeJumps
|
meta.evictionBlobFeeJumps = meta.blobfeeJumps
|
||||||
if meta.nonce > next && len(p.index[from]) >= offset {
|
if meta.nonce > next { // transaction can't be gapped, we filter for that in validateTx
|
||||||
prev := p.index[from][int(meta.nonce-next-1)]
|
prev := p.index[from][int(meta.nonce-next-1)]
|
||||||
if meta.evictionExecTip.Cmp(prev.evictionExecTip) > 0 {
|
if meta.evictionExecTip.Cmp(prev.evictionExecTip) > 0 {
|
||||||
meta.evictionExecTip = prev.evictionExecTip
|
meta.evictionExecTip = prev.evictionExecTip
|
||||||
|
|
@ -1672,20 +1672,13 @@ func (p *BlobPool) addLocked(tx *types.Transaction, checkGapped bool) (err error
|
||||||
p.lookup.track(meta)
|
p.lookup.track(meta)
|
||||||
p.stored += uint64(meta.storageSize)
|
p.stored += uint64(meta.storageSize)
|
||||||
}
|
}
|
||||||
// Recompute the rolling eviction fields. In case of a replacement, this will
|
// Recompute the rolling eviction fields for subsequent transactions
|
||||||
// recompute all subsequent fields. In case of an append, this will only do
|
// (we've already calculated for the new/updated transaction above).
|
||||||
// the fresh calculation.
|
// In case of a replacement, this will recompute all subsequent fields.
|
||||||
|
// In case of an append, this will only do the fresh calculation.
|
||||||
txs := p.index[from]
|
txs := p.index[from]
|
||||||
|
|
||||||
for i := offset; i < len(txs); i++ {
|
for i := offset + 1; i < len(txs); i++ {
|
||||||
// The first transaction will always use itself
|
|
||||||
if i == 0 {
|
|
||||||
txs[0].evictionExecTip = txs[0].execTipCap
|
|
||||||
txs[0].evictionExecFeeJumps = txs[0].basefeeJumps
|
|
||||||
txs[0].evictionBlobFeeJumps = txs[0].blobfeeJumps
|
|
||||||
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// Subsequent transactions will use a rolling calculation
|
// Subsequent transactions will use a rolling calculation
|
||||||
txs[i].evictionExecTip = txs[i-1].evictionExecTip
|
txs[i].evictionExecTip = txs[i-1].evictionExecTip
|
||||||
if txs[i].evictionExecTip.Cmp(txs[i].execTipCap) > 0 {
|
if txs[i].evictionExecTip.Cmp(txs[i].execTipCap) > 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue