Skip to content

Commit

Permalink
Remove header.Extra from EstimateNextBaseFee (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored and ceyonur committed Feb 26, 2025
1 parent e501c94 commit 8f595de
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions consensus/dummy/dynamic_fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ func CalcBaseFee(config *params.ChainConfig, feeConfig commontype.FeeConfig, par
// If [timestamp] is less than the timestamp of [parent], then it uses the same timestamp as parent.
// Warning: This function should only be used in estimation and should not be used when calculating the canonical
// base fee for a subsequent block.
func EstimateNextBaseFee(config *params.ChainConfig, feeConfig commontype.FeeConfig, parent *types.Header, timestamp uint64) ([]byte, *big.Int, error) {
func EstimateNextBaseFee(config *params.ChainConfig, feeConfig commontype.FeeConfig, parent *types.Header, timestamp uint64) (*big.Int, error) {
if timestamp < parent.Time {
timestamp = parent.Time
}
return CalcBaseFee(config, feeConfig, parent, timestamp)
_, baseFee, err := CalcBaseFee(config, feeConfig, parent, timestamp)
return baseFee, err
}

// selectBigWithinBounds returns [value] if it is within the bounds:
Expand Down
4 changes: 2 additions & 2 deletions core/txpool/blobpool/blobpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ func (p *BlobPool) Init(gasTip uint64, head *types.Header, reserve txpool.Addres
p.Close()
return err
}
_, baseFee, err := dummy.EstimateNextBaseFee(
baseFee, err := dummy.EstimateNextBaseFee(
p.chain.Config(),
feeConfig,
p.head,
Expand Down Expand Up @@ -851,7 +851,7 @@ func (p *BlobPool) Reset(oldHead, newHead *types.Header) {
log.Error("Failed to get fee config to reset blobpool fees", "err", err)
return
}
_, baseFeeBig, err := dummy.EstimateNextBaseFee(
baseFeeBig, err := dummy.EstimateNextBaseFee(
p.chain.Config(),
feeConfig,
p.head,
Expand Down
2 changes: 1 addition & 1 deletion core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,7 @@ func (pool *LegacyPool) updateBaseFeeAt(head *types.Header) error {
if err != nil {
return err
}
_, baseFeeEstimate, err := dummy.EstimateNextBaseFee(pool.chainconfig, feeConfig, head, uint64(time.Now().Unix()))
baseFeeEstimate, err := dummy.EstimateNextBaseFee(pool.chainconfig, feeConfig, head, uint64(time.Now().Unix()))
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions eth/gasprice/gasprice.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ func (oracle *Oracle) estimateNextBaseFee(ctx context.Context) (*big.Int, error)
// If the block does have a baseFee, calculate the next base fee
// based on the current time and add it to the tip to estimate the
// total gas price estimate.
_, nextBaseFee, err := dummy.EstimateNextBaseFee(oracle.backend.ChainConfig(), feeConfig, header, oracle.clock.Unix())
return nextBaseFee, err
return dummy.EstimateNextBaseFee(oracle.backend.ChainConfig(), feeConfig, header, oracle.clock.Unix())
}

// SuggestPrice returns an estimated price for legacy transactions.
Expand Down

0 comments on commit 8f595de

Please sign in to comment.