diff options
Diffstat (limited to 'rpc/api/miner.go')
-rw-r--r-- | rpc/api/miner.go | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/rpc/api/miner.go b/rpc/api/miner.go index b22c4b7ad..496269304 100644 --- a/rpc/api/miner.go +++ b/rpc/api/miner.go @@ -15,30 +15,30 @@ const ( var ( // mapping between methods and handlers MinerMapping = map[string]minerhandler{ - "miner_hashrate": (*miner).Hashrate, - "miner_makeDAG": (*miner).MakeDAG, - "miner_setExtra": (*miner).SetExtra, - "miner_setGasPrice": (*miner).SetGasPrice, - "miner_startAutoDAG": (*miner).StartAutoDAG, - "miner_start": (*miner).StartMiner, - "miner_stopAutoDAG": (*miner).StopAutoDAG, - "miner_stop": (*miner).StopMiner, + "miner_hashrate": (*minerApi).Hashrate, + "miner_makeDAG": (*minerApi).MakeDAG, + "miner_setExtra": (*minerApi).SetExtra, + "miner_setGasPrice": (*minerApi).SetGasPrice, + "miner_startAutoDAG": (*minerApi).StartAutoDAG, + "miner_start": (*minerApi).StartMiner, + "miner_stopAutoDAG": (*minerApi).StopAutoDAG, + "miner_stop": (*minerApi).StopMiner, } ) // miner callback handler -type minerhandler func(*miner, *shared.Request) (interface{}, error) +type minerhandler func(*minerApi, *shared.Request) (interface{}, error) // miner api provider -type miner struct { +type minerApi struct { ethereum *eth.Ethereum methods map[string]minerhandler codec codec.ApiCoder } // create a new miner api instance -func NewMinerApi(ethereum *eth.Ethereum, coder codec.Codec) *miner { - return &miner{ +func NewMinerApi(ethereum *eth.Ethereum, coder codec.Codec) *minerApi { + return &minerApi{ ethereum: ethereum, methods: MinerMapping, codec: coder.New(nil), @@ -46,7 +46,7 @@ func NewMinerApi(ethereum *eth.Ethereum, coder codec.Codec) *miner { } // Execute given request -func (self *miner) Execute(req *shared.Request) (interface{}, error) { +func (self *minerApi) Execute(req *shared.Request) (interface{}, error) { if callback, ok := self.methods[req.Method]; ok { return callback(self, req) } @@ -55,7 +55,7 @@ func (self *miner) Execute(req *shared.Request) (interface{}, error) { } // collection with supported methods -func (self *miner) Methods() []string { +func (self *minerApi) Methods() []string { methods := make([]string, len(self.methods)) i := 0 for k := range self.methods { @@ -65,11 +65,11 @@ func (self *miner) Methods() []string { return methods } -func (self *miner) Name() string { +func (self *minerApi) Name() string { return MinerApiName } -func (self *miner) StartMiner(req *shared.Request) (interface{}, error) { +func (self *minerApi) StartMiner(req *shared.Request) (interface{}, error) { args := new(StartMinerArgs) if err := self.codec.Decode(req.Params, &args); err != nil { return nil, err @@ -87,16 +87,16 @@ func (self *miner) StartMiner(req *shared.Request) (interface{}, error) { return false, err } -func (self *miner) StopMiner(req *shared.Request) (interface{}, error) { +func (self *minerApi) StopMiner(req *shared.Request) (interface{}, error) { self.ethereum.StopMining() return true, nil } -func (self *miner) Hashrate(req *shared.Request) (interface{}, error) { +func (self *minerApi) Hashrate(req *shared.Request) (interface{}, error) { return self.ethereum.Miner().HashRate(), nil } -func (self *miner) SetExtra(req *shared.Request) (interface{}, error) { +func (self *minerApi) SetExtra(req *shared.Request) (interface{}, error) { args := new(SetExtraArgs) if err := self.codec.Decode(req.Params, &args); err != nil { return nil, err @@ -105,7 +105,7 @@ func (self *miner) SetExtra(req *shared.Request) (interface{}, error) { return true, nil } -func (self *miner) SetGasPrice(req *shared.Request) (interface{}, error) { +func (self *minerApi) SetGasPrice(req *shared.Request) (interface{}, error) { args := new(GasPriceArgs) if err := self.codec.Decode(req.Params, &args); err != nil { return false, err @@ -115,17 +115,17 @@ func (self *miner) SetGasPrice(req *shared.Request) (interface{}, error) { return true, nil } -func (self *miner) StartAutoDAG(req *shared.Request) (interface{}, error) { +func (self *minerApi) StartAutoDAG(req *shared.Request) (interface{}, error) { self.ethereum.StartAutoDAG() return true, nil } -func (self *miner) StopAutoDAG(req *shared.Request) (interface{}, error) { +func (self *minerApi) StopAutoDAG(req *shared.Request) (interface{}, error) { self.ethereum.StopAutoDAG() return true, nil } -func (self *miner) MakeDAG(req *shared.Request) (interface{}, error) { +func (self *minerApi) MakeDAG(req *shared.Request) (interface{}, error) { args := new(MakeDAGArgs) if err := self.codec.Decode(req.Params, &args); err != nil { return nil, err |