mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
core/txpool/blobpool: nitpicks
This commit is contained in:
parent
1a7c8d5d70
commit
e2ddb090f3
1 changed files with 6 additions and 9 deletions
|
|
@ -369,11 +369,6 @@ type BlobPool struct {
|
||||||
lock sync.RWMutex // Mutex protecting the pool during reorg handling
|
lock sync.RWMutex // Mutex protecting the pool during reorg handling
|
||||||
}
|
}
|
||||||
|
|
||||||
type gappedTx struct {
|
|
||||||
tx *types.Transaction
|
|
||||||
timestamp time.Time
|
|
||||||
}
|
|
||||||
|
|
||||||
// New creates a new blob transaction pool to gather, sort and filter inbound
|
// New creates a new blob transaction pool to gather, sort and filter inbound
|
||||||
// blob transactions from the network.
|
// blob transactions from the network.
|
||||||
func New(config Config, chain BlockChain, hasPendingAuth func(common.Address) bool) *BlobPool {
|
func New(config Config, chain BlockChain, hasPendingAuth func(common.Address) bool) *BlobPool {
|
||||||
|
|
@ -1769,14 +1764,16 @@ func (p *BlobPool) addLocked(tx *types.Transaction, checkGapped bool) (err error
|
||||||
from, _ := types.Sender(p.signer, tx)
|
from, _ := types.Sender(p.signer, tx)
|
||||||
allowance := p.gappedAllowance(from)
|
allowance := p.gappedAllowance(from)
|
||||||
if allowance >= 1 && len(p.gapped) < maxGapped {
|
if allowance >= 1 && len(p.gapped) < maxGapped {
|
||||||
// if maxGapped is reached, it is better to give time to gapped
|
|
||||||
// transactions by keeping the old and dropping this one
|
|
||||||
p.gapped[from] = append(p.gapped[from], tx)
|
p.gapped[from] = append(p.gapped[from], tx)
|
||||||
p.gappedSource[tx.Hash()] = from
|
p.gappedSource[tx.Hash()] = from
|
||||||
log.Trace("blobpool:add added to Gapped blob queue", "allowance", allowance, "hash", tx.Hash(), "from", from, "nonce", tx.Nonce(), "qlen", len(p.gapped[from]))
|
log.Trace("added tx to gapped blob queue", "allowance", allowance, "hash", tx.Hash(), "from", from, "nonce", tx.Nonce(), "qlen", len(p.gapped[from]))
|
||||||
return nil
|
return nil
|
||||||
} else {
|
} else {
|
||||||
log.Trace("blobpool:add no Gapped blob queue allowance", "allowance", allowance, "hash", tx.Hash(), "from", from, "nonce", tx.Nonce(), "qlen", len(p.gapped[from]))
|
// if maxGapped is reached, it is better to give time to gapped
|
||||||
|
// transactions by keeping the old and dropping this one.
|
||||||
|
// Thus replacing a gapped transaction with another gapped transaction
|
||||||
|
// is discouraged.
|
||||||
|
log.Trace("no gapped blob queue allowance", "allowance", allowance, "hash", tx.Hash(), "from", from, "nonce", tx.Nonce(), "qlen", len(p.gapped[from]))
|
||||||
}
|
}
|
||||||
case errors.Is(err, core.ErrInsufficientFunds):
|
case errors.Is(err, core.ErrInsufficientFunds):
|
||||||
addOverdraftedMeter.Mark(1)
|
addOverdraftedMeter.Mark(1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue