Skip to content

Commit

Permalink
ethpoint GasPrice() return default 50 Gwei. (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
abrahamcruise321 authored Apr 26, 2022
1 parent 9d3712f commit e06eaaf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion jsonrpc/eth_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,18 @@ func (e *Eth) GetStorageAt(

// GasPrice returns the average gas price based on the last x blocks
func (e *Eth) GasPrice() (interface{}, error) {
var avgGasPrice string

// Grab the average gas price and convert it to a hex value
avgGasPrice := hex.EncodeBig(e.store.GetAvgGasPrice())
minGasPrice := new(big.Int).Mul(
big.NewInt(50),
new(big.Int).Exp(big.NewInt(10), big.NewInt(9), nil))

if e.store.GetAvgGasPrice().Cmp(minGasPrice) == -1 {
avgGasPrice = hex.EncodeBig(minGasPrice)
} else {
avgGasPrice = hex.EncodeBig(e.store.GetAvgGasPrice())
}

return avgGasPrice, nil
}
Expand Down

1 comment on commit e06eaaf

@zivkovicmilos
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you get the minimum 50 Gwei value? Is it an arbitrary value?

Please sign in to comment.