aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-02 23:36:48 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-02 23:36:48 +0800
commitfb2488235a9cc187047810817ce3fa34c5087c67 (patch)
tree97961eb2de4c67e23e1ae3a35f1c3979bdf03ba1 /rpc
parent540c79e6adbb5b616e6a1e0612d69dfba07776c9 (diff)
downloaddexon-fb2488235a9cc187047810817ce3fa34c5087c67.tar.gz
dexon-fb2488235a9cc187047810817ce3fa34c5087c67.tar.zst
dexon-fb2488235a9cc187047810817ce3fa34c5087c67.zip
Remove defunct calls
Diffstat (limited to 'rpc')
-rw-r--r--rpc/api.go92
1 files changed, 30 insertions, 62 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 782b5848c..28ec04916 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -52,20 +52,20 @@ type EthereumApi struct {
db ethutil.Database
- defaultBlockAge int64
+ // defaultBlockAge int64
}
func NewEthereumApi(eth *xeth.XEth) *EthereumApi {
db, _ := ethdb.NewLDBDatabase("dapps")
api := &EthereumApi{
- eth: eth,
- mux: eth.Backend().EventMux(),
- quit: make(chan struct{}),
- filterManager: filter.NewFilterManager(eth.Backend().EventMux()),
- logs: make(map[int]*logFilter),
- messages: make(map[int]*whisperFilter),
- db: db,
- defaultBlockAge: -1,
+ eth: eth,
+ mux: eth.Backend().EventMux(),
+ quit: make(chan struct{}),
+ filterManager: filter.NewFilterManager(eth.Backend().EventMux()),
+ logs: make(map[int]*logFilter),
+ messages: make(map[int]*whisperFilter),
+ db: db,
+ // defaultBlockAge: -1,
}
go api.filterManager.Start()
go api.start()
@@ -73,36 +73,36 @@ func NewEthereumApi(eth *xeth.XEth) *EthereumApi {
return api
}
-func (self *EthereumApi) setStateByBlockNumber(num int64) {
- chain := self.xeth().Backend().ChainManager()
- var block *types.Block
+// func (self *EthereumApi) setStateByBlockNumber(num int64) {
+// chain := self.xeth().Backend().ChainManager()
+// var block *types.Block
- if self.defaultBlockAge < 0 {
- num = chain.CurrentBlock().Number().Int64() + num + 1
- }
- block = chain.GetBlockByNumber(uint64(num))
+// if self.defaultBlockAge < 0 {
+// num = chain.CurrentBlock().Number().Int64() + num + 1
+// }
+// block = chain.GetBlockByNumber(uint64(num))
- if block != nil {
- self.useState(state.New(block.Root(), self.xeth().Backend().Db()))
- } else {
- self.useState(chain.State())
- }
-}
+// if block != nil {
+// self.useState(state.New(block.Root(), self.xeth().Backend().Db()))
+// } else {
+// self.useState(chain.State())
+// }
+// }
func (self *EthereumApi) start() {
timer := time.NewTicker(filterTickerTime)
- events := self.mux.Subscribe(core.ChainEvent{})
+ // events := self.mux.Subscribe(core.ChainEvent{})
done:
for {
select {
- case ev := <-events.Chan():
- switch ev.(type) {
- case core.ChainEvent:
- if self.defaultBlockAge < 0 {
- self.setStateByBlockNumber(self.defaultBlockAge)
- }
- }
+ // case ev := <-events.Chan():
+ // switch ev.(type) {
+ // case core.ChainEvent:
+ // if self.defaultBlockAge < 0 {
+ // self.setStateByBlockNumber(self.defaultBlockAge)
+ // }
+ // }
case <-timer.C:
self.logMut.Lock()
self.messagesMut.Lock()
@@ -365,24 +365,6 @@ func (p *EthereumApi) GetIsMining(reply *interface{}) error {
return nil
}
-func (p *EthereumApi) SetMining(shouldmine bool, reply *interface{}) error {
- *reply = p.xeth().SetMining(shouldmine)
- return nil
-}
-
-func (p *EthereumApi) GetDefaultBlockAge(reply *interface{}) error {
- *reply = p.defaultBlockAge
- return nil
-}
-
-func (p *EthereumApi) SetDefaultBlockAge(defaultBlockAge int64, reply *interface{}) error {
- p.defaultBlockAge = defaultBlockAge
- p.setStateByBlockNumber(p.defaultBlockAge)
-
- *reply = true
- return nil
-}
-
func (p *EthereumApi) BlockNumber(reply *interface{}) error {
*reply = p.xeth().Backend().ChainManager().CurrentBlock().Number()
return nil
@@ -515,20 +497,6 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return p.GetCoinbase(reply)
case "eth_mining":
return p.GetIsMining(reply)
- case "eth_setMining":
- args, err := req.ToBoolArgs()
- if err != nil {
- return err
- }
- return p.SetMining(args, reply)
- case "eth_defaultBlock":
- return p.GetDefaultBlockAge(reply)
- case "eth_setDefaultBlock":
- args, err := req.ToIntArgs()
- if err != nil {
- return err
- }
- return p.SetDefaultBlockAge(int64(args), reply)
case "eth_number":
return p.BlockNumber(reply)
case "eth_accounts":