diff options
Diffstat (limited to 'eth/backend.go')
-rw-r--r-- | eth/backend.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/eth/backend.go b/eth/backend.go index 76cf8783b..9722e9625 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -119,6 +119,7 @@ type Ethereum struct { protocolManager *ProtocolManager SolcPath string solc *compiler.Solidity + gpo *GasPriceOracle GpoMinGasPrice *big.Int GpoMaxGasPrice *big.Int @@ -260,6 +261,8 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { } return nil, err } + eth.gpo = NewGasPriceOracle(eth) + newPool := core.NewTxPool(eth.chainConfig, eth.EventMux(), eth.blockchain.State, eth.blockchain.GasLimit) eth.txPool = newPool @@ -276,34 +279,31 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { // APIs returns the collection of RPC services the ethereum package offers. // NOTE, some of these services probably need to be moved to somewhere else. func (s *Ethereum) APIs() []rpc.API { - // share gas price oracle in API's - gpo := NewGasPriceOracle(s) - return []rpc.API{ { Namespace: "eth", Version: "1.0", - Service: NewPublicEthereumAPI(s, gpo), + Service: NewPublicEthereumAPI(s), Public: true, }, { Namespace: "eth", Version: "1.0", - Service: NewPublicAccountAPI(s.AccountManager()), + Service: NewPublicAccountAPI(s.accountManager), Public: true, }, { Namespace: "personal", Version: "1.0", - Service: NewPrivateAccountAPI(s.AccountManager()), + Service: NewPrivateAccountAPI(s.accountManager), Public: false, }, { Namespace: "eth", Version: "1.0", - Service: NewPublicBlockChainAPI(s.chainConfig, s.BlockChain(), s.Miner(), s.ChainDb(), gpo, s.EventMux(), s.AccountManager()), + Service: NewPublicBlockChainAPI(s.chainConfig, s.blockchain, s.miner, s.chainDb, s.gpo, s.eventMux, s.accountManager), Public: true, }, { Namespace: "eth", Version: "1.0", - Service: NewPublicTransactionPoolAPI(s, gpo), + Service: NewPublicTransactionPoolAPI(s), Public: true, }, { Namespace: "eth", @@ -313,7 +313,7 @@ func (s *Ethereum) APIs() []rpc.API { }, { Namespace: "eth", Version: "1.0", - Service: downloader.NewPublicDownloaderAPI(s.Downloader(), s.EventMux()), + Service: downloader.NewPublicDownloaderAPI(s.protocolManager.downloader, s.eventMux), Public: true, }, { Namespace: "miner", @@ -328,7 +328,7 @@ func (s *Ethereum) APIs() []rpc.API { }, { Namespace: "eth", Version: "1.0", - Service: filters.NewPublicFilterAPI(s.ChainDb(), s.EventMux()), + Service: filters.NewPublicFilterAPI(s.chainDb, s.eventMux), Public: true, }, { Namespace: "admin", @@ -351,7 +351,7 @@ func (s *Ethereum) APIs() []rpc.API { }, { Namespace: "admin", Version: "1.0", - Service: ethreg.NewPrivateRegistarAPI(s.chainConfig, s.BlockChain(), s.ChainDb(), s.TxPool(), s.AccountManager()), + Service: ethreg.NewPrivateRegistarAPI(s.chainConfig, s.blockchain, s.chainDb, s.txPool, s.accountManager), }, } } |