mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
ethapi: fix receiver name warning (#1908)
This commit is contained in:
parent
7684d88d3c
commit
3147cf7835
1 changed files with 6 additions and 6 deletions
|
|
@ -2660,18 +2660,18 @@ type tokenSupply struct {
|
||||||
BlockNumber *hexutil.Big `json:"blockNumber"`
|
BlockNumber *hexutil.Big `json:"blockNumber"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *BlockChainAPI) GetTokenStats(ctx context.Context, epochNr rpc.EpochNumber) (*tokenSupply, error) {
|
func (api *BlockChainAPI) GetTokenStats(ctx context.Context, epochNr rpc.EpochNumber) (*tokenSupply, error) {
|
||||||
engine, ok := s.b.Engine().(*XDPoS.XDPoS)
|
engine, ok := api.b.Engine().(*XDPoS.XDPoS)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("undefined XDPoS consensus engine")
|
return nil, errors.New("undefined XDPoS consensus engine")
|
||||||
}
|
}
|
||||||
statedb, header, _ := s.b.StateAndHeaderByNumber(ctx, rpc.LatestBlockNumber)
|
statedb, header, _ := api.b.StateAndHeaderByNumber(ctx, rpc.LatestBlockNumber)
|
||||||
nonce := statedb.GetNonce(common.MintedRecordAddressBinary)
|
nonce := statedb.GetNonce(common.MintedRecordAddressBinary)
|
||||||
if nonce == 0 {
|
if nonce == 0 {
|
||||||
return nil, errors.New("mintedRecordAddress is not initialized due to Reward Upgrade is not applied")
|
return nil, errors.New("mintedRecordAddress is not initialized due to Reward Upgrade is not applied")
|
||||||
}
|
}
|
||||||
currentRound, err := engine.EngineV2.GetRoundNumber(header)
|
currentRound, err := engine.EngineV2.GetRoundNumber(header)
|
||||||
currentEpoch := s.b.ChainConfig().XDPoS.V2.SwitchEpoch + uint64(currentRound)/s.b.ChainConfig().XDPoS.Epoch
|
currentEpoch := api.b.ChainConfig().XDPoS.V2.SwitchEpoch + uint64(currentRound)/api.b.ChainConfig().XDPoS.Epoch
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -2690,11 +2690,11 @@ func (s *BlockChainAPI) GetTokenStats(ctx context.Context, epochNr rpc.EpochNumb
|
||||||
}
|
}
|
||||||
postMinted := statedb.GetPostMinted(epochNum).Big()
|
postMinted := statedb.GetPostMinted(epochNum).Big()
|
||||||
number := statedb.GetPostRewardBlock(epochNum).Big()
|
number := statedb.GetPostRewardBlock(epochNum).Big()
|
||||||
targetHeader, err := s.b.HeaderByNumber(ctx, rpc.BlockNumber(number.Int64()))
|
targetHeader, err := api.b.HeaderByNumber(ctx, rpc.BlockNumber(number.Int64()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
config := s.b.ChainConfig().XDPoS
|
config := api.b.ChainConfig().XDPoS
|
||||||
if config == nil {
|
if config == nil {
|
||||||
return nil, errors.New("xdpos config is nil")
|
return nil, errors.New("xdpos config is nil")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue