cmd/utils, eth: rename ApiBackend to APIBackend (#1955)

This commit is contained in:
Daniel Liu 2026-01-16 19:57:48 +08:00 committed by GitHub
parent 5f911680c0
commit 3e68f0e1d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 11 deletions

View file

@ -1610,8 +1610,8 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config, XDCXServ *XDCx.
if err != nil { if err != nil {
Fatalf("Failed to register the Ethereum service: %v", err) Fatalf("Failed to register the Ethereum service: %v", err)
} }
stack.RegisterAPIs(tracers.APIs(backend.ApiBackend)) stack.RegisterAPIs(tracers.APIs(backend.APIBackend))
return backend.ApiBackend, backend return backend.APIBackend, backend
} }
// RegisterEthStatsService configures the Ethereum Stats daemon and adds it to the node. // RegisterEthStatsService configures the Ethereum Stats daemon and adds it to the node.

View file

@ -65,7 +65,7 @@ func (api *EthereumAPI) ChainId() hexutil.Uint64 {
// GetOwner return masternode owner of the given coinbase address // GetOwner return masternode owner of the given coinbase address
func (api *EthereumAPI) GetOwnerByCoinbase(ctx context.Context, coinbase common.Address, blockNr rpc.BlockNumber) (common.Address, error) { func (api *EthereumAPI) GetOwnerByCoinbase(ctx context.Context, coinbase common.Address, blockNr rpc.BlockNumber) (common.Address, error) {
statedb, _, err := api.e.ApiBackend.StateAndHeaderByNumber(ctx, blockNr) statedb, _, err := api.e.APIBackend.StateAndHeaderByNumber(ctx, blockNr)
if err != nil { if err != nil {
return common.Address{}, err return common.Address{}, err
} }

View file

@ -429,7 +429,6 @@ func (b *EthAPIBackend) StateAtTransaction(ctx context.Context, block *types.Blo
} }
func (b *EthAPIBackend) GetIPCClient() (bind.ContractBackend, error) { func (b *EthAPIBackend) GetIPCClient() (bind.ContractBackend, error) {
// func (b *EthApiBackend) GetIPCClient() (*ethclient.Client, error) {
client, err := b.eth.blockchain.GetClient() client, err := b.eth.blockchain.GetClient()
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -107,7 +107,7 @@ func (api *DebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error)
} else { } else {
blockRlp = fmt.Sprintf("%#x", rlpBytes) blockRlp = fmt.Sprintf("%#x", rlpBytes)
} }
blockJSON = ethapi.RPCMarshalBlock(block, true, true, api.eth.ApiBackend.ChainConfig()) blockJSON = ethapi.RPCMarshalBlock(block, true, true, api.eth.APIBackend.ChainConfig())
results = append(results, &BadBlockArgs{ results = append(results, &BadBlockArgs{
Hash: block.Hash(), Hash: block.Hash(),
RLP: blockRlp, RLP: blockRlp,

View file

@ -90,7 +90,7 @@ type Ethereum struct {
bloomRequests chan chan *bloombits.Retrieval // Channel receiving bloom data retrieval requests bloomRequests chan chan *bloombits.Retrieval // Channel receiving bloom data retrieval requests
bloomIndexer *core.ChainIndexer // Bloom indexer operating during block imports bloomIndexer *core.ChainIndexer // Bloom indexer operating during block imports
ApiBackend *EthAPIBackend APIBackend *EthAPIBackend
miner *miner.Miner miner *miner.Miner
gasPrice *big.Int gasPrice *big.Int
@ -287,17 +287,17 @@ func New(stack *node.Node, config *ethconfig.Config, XDCXServ *XDCx.XDCX, lendin
if eth.chainConfig.XDPoS != nil { if eth.chainConfig.XDPoS != nil {
xdPoS = eth.engine.(*XDPoS.XDPoS) xdPoS = eth.engine.(*XDPoS.XDPoS)
} }
eth.ApiBackend = &EthAPIBackend{ eth.APIBackend = &EthAPIBackend{
allowUnprotectedTxs: stack.Config().AllowUnprotectedTxs, allowUnprotectedTxs: stack.Config().AllowUnprotectedTxs,
eth: eth, eth: eth,
gpo: nil, gpo: nil,
XDPoS: xdPoS, XDPoS: xdPoS,
} }
if eth.ApiBackend.allowUnprotectedTxs { if eth.APIBackend.allowUnprotectedTxs {
log.Info("Unprotected transactions allowed") log.Info("Unprotected transactions allowed")
} }
eth.ApiBackend.gpo = gasprice.NewOracle(eth.ApiBackend, config.GPO, config.GasPrice) eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, config.GPO, config.GasPrice)
// Set global ipc endpoint. // Set global ipc endpoint.
eth.blockchain.IPCEndpoint = stack.IPCEndpoint() eth.blockchain.IPCEndpoint = stack.IPCEndpoint()
@ -408,7 +408,7 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, db
// APIs return the collection of RPC services the ethereum package offers. // APIs return the collection of RPC services the ethereum package offers.
// NOTE, some of these services probably need to be moved to somewhere else. // NOTE, some of these services probably need to be moved to somewhere else.
func (e *Ethereum) APIs() []rpc.API { func (e *Ethereum) APIs() []rpc.API {
apis := ethapi.GetAPIs(e.ApiBackend, e.BlockChain()) apis := ethapi.GetAPIs(e.APIBackend, e.BlockChain())
// Append any APIs exposed explicitly by the consensus engine // Append any APIs exposed explicitly by the consensus engine
apis = append(apis, e.engine.APIs(e.BlockChain())...) apis = append(apis, e.engine.APIs(e.BlockChain())...)
@ -426,7 +426,7 @@ func (e *Ethereum) APIs() []rpc.API {
Service: downloader.NewDownloaderAPI(e.protocolManager.downloader, e.eventMux), Service: downloader.NewDownloaderAPI(e.protocolManager.downloader, e.eventMux),
}, { }, {
Namespace: "eth", Namespace: "eth",
Service: filters.NewFilterAPI(filters.NewFilterSystem(e.ApiBackend, filters.Config{LogCacheSize: e.config.FilterLogCacheSize}), false), Service: filters.NewFilterAPI(filters.NewFilterSystem(e.APIBackend, filters.Config{LogCacheSize: e.config.FilterLogCacheSize}), false),
}, { }, {
Namespace: "admin", Namespace: "admin",
Service: NewAdminAPI(e), Service: NewAdminAPI(e),