mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-15 16:33:47 +00:00
Merge pull request #8 from DeBankDeFi/ethapi-add-basefee
ethapi add basefee
This commit is contained in:
commit
8ca5ef6121
1 changed files with 10 additions and 0 deletions
10
eth/api.go
10
eth/api.go
|
|
@ -30,6 +30,7 @@ import (
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
|
"github.com/ethereum/go-ethereum/consensus/misc"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
|
|
@ -56,6 +57,15 @@ func (api *PublicEthereumAPI) Etherbase() (common.Address, error) {
|
||||||
return api.e.Etherbase()
|
return api.e.Etherbase()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BaseFee for rpc
|
||||||
|
func (api *PublicEthereumAPI) BaseFee(ctx context.Context) (*big.Int, error) {
|
||||||
|
header, err := api.e.APIBackend.HeaderByNumber(ctx, rpc.LatestBlockNumber)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return misc.CalcBaseFee(api.e.APIBackend.ChainConfig(), header), nil
|
||||||
|
}
|
||||||
|
|
||||||
// Coinbase is the address that mining rewards will be send to (alias for Etherbase)
|
// Coinbase is the address that mining rewards will be send to (alias for Etherbase)
|
||||||
func (api *PublicEthereumAPI) Coinbase() (common.Address, error) {
|
func (api *PublicEthereumAPI) Coinbase() (common.Address, error) {
|
||||||
return api.Etherbase()
|
return api.Etherbase()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue