diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 553a53d25d..ac4ef45ada 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1610,8 +1610,8 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config, XDCXServ *XDCx. if err != nil { Fatalf("Failed to register the Ethereum service: %v", err) } - stack.RegisterAPIs(tracers.APIs(backend.ApiBackend)) - return backend.ApiBackend, backend + stack.RegisterAPIs(tracers.APIs(backend.APIBackend)) + return backend.APIBackend, backend } // RegisterEthStatsService configures the Ethereum Stats daemon and adds it to the node. diff --git a/eth/api.go b/eth/api.go index df2a6cf73a..0fa09b443b 100644 --- a/eth/api.go +++ b/eth/api.go @@ -65,7 +65,7 @@ func (api *EthereumAPI) ChainId() hexutil.Uint64 { // 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) { - statedb, _, err := api.e.ApiBackend.StateAndHeaderByNumber(ctx, blockNr) + statedb, _, err := api.e.APIBackend.StateAndHeaderByNumber(ctx, blockNr) if err != nil { return common.Address{}, err } diff --git a/eth/api_backend.go b/eth/api_backend.go index fecd4024cd..00ac5006e6 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -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() (*ethclient.Client, error) { client, err := b.eth.blockchain.GetClient() if err != nil { return nil, err diff --git a/eth/api_debug.go b/eth/api_debug.go index 9a8ae3d519..cdd7c589aa 100644 --- a/eth/api_debug.go +++ b/eth/api_debug.go @@ -107,7 +107,7 @@ func (api *DebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error) } else { 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{ Hash: block.Hash(), RLP: blockRlp, diff --git a/eth/backend.go b/eth/backend.go index 70d9ea18f4..fe6cb386e7 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -90,7 +90,7 @@ type Ethereum struct { bloomRequests chan chan *bloombits.Retrieval // Channel receiving bloom data retrieval requests bloomIndexer *core.ChainIndexer // Bloom indexer operating during block imports - ApiBackend *EthAPIBackend + APIBackend *EthAPIBackend miner *miner.Miner gasPrice *big.Int @@ -287,17 +287,17 @@ func New(stack *node.Node, config *ethconfig.Config, XDCXServ *XDCx.XDCX, lendin if eth.chainConfig.XDPoS != nil { xdPoS = eth.engine.(*XDPoS.XDPoS) } - eth.ApiBackend = &EthAPIBackend{ + eth.APIBackend = &EthAPIBackend{ allowUnprotectedTxs: stack.Config().AllowUnprotectedTxs, eth: eth, gpo: nil, XDPoS: xdPoS, } - if eth.ApiBackend.allowUnprotectedTxs { + if eth.APIBackend.allowUnprotectedTxs { 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. 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. // NOTE, some of these services probably need to be moved to somewhere else. 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 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), }, { 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", Service: NewAdminAPI(e),