Skip to content

Commit

Permalink
fix(api): change gas_price to use pending block
Browse files Browse the repository at this point in the history
  • Loading branch information
yiweichi committed Oct 24, 2024
1 parent c88cc48 commit 950c75b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ func (s *PublicEthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)
if err != nil {
return nil, err
}
if head := s.b.CurrentHeader(); head.BaseFee != nil {
tipcap.Add(tipcap, head.BaseFee)
bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
block, err := s.b.BlockByNumberOrHash(ctx, bNrOrHash)
if err != nil {
return &hexutil.Big{}, err
}
if block.BaseFee() != nil {
tipcap.Add(tipcap, block.BaseFee())
}
return (*hexutil.Big)(tipcap), err
}
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 7 // Minor version component of the current release
VersionPatch = 24 // Patch version component of the current release
VersionPatch = 25 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down

0 comments on commit 950c75b

Please sign in to comment.