Remove defunct calls

This commit is contained in:
Taylor Gerring 2015-03-02 09:36:48 -06:00
parent 540c79e6ad
commit fb2488235a

View File

@ -52,7 +52,7 @@ type EthereumApi struct {
db ethutil.Database db ethutil.Database
defaultBlockAge int64 // defaultBlockAge int64
} }
func NewEthereumApi(eth *xeth.XEth) *EthereumApi { func NewEthereumApi(eth *xeth.XEth) *EthereumApi {
@ -65,7 +65,7 @@ func NewEthereumApi(eth *xeth.XEth) *EthereumApi {
logs: make(map[int]*logFilter), logs: make(map[int]*logFilter),
messages: make(map[int]*whisperFilter), messages: make(map[int]*whisperFilter),
db: db, db: db,
defaultBlockAge: -1, // defaultBlockAge: -1,
} }
go api.filterManager.Start() go api.filterManager.Start()
go api.start() go api.start()
@ -73,36 +73,36 @@ func NewEthereumApi(eth *xeth.XEth) *EthereumApi {
return api return api
} }
func (self *EthereumApi) setStateByBlockNumber(num int64) { // func (self *EthereumApi) setStateByBlockNumber(num int64) {
chain := self.xeth().Backend().ChainManager() // chain := self.xeth().Backend().ChainManager()
var block *types.Block // var block *types.Block
if self.defaultBlockAge < 0 { // if self.defaultBlockAge < 0 {
num = chain.CurrentBlock().Number().Int64() + num + 1 // num = chain.CurrentBlock().Number().Int64() + num + 1
} // }
block = chain.GetBlockByNumber(uint64(num)) // block = chain.GetBlockByNumber(uint64(num))
if block != nil { // if block != nil {
self.useState(state.New(block.Root(), self.xeth().Backend().Db())) // self.useState(state.New(block.Root(), self.xeth().Backend().Db()))
} else { // } else {
self.useState(chain.State()) // self.useState(chain.State())
} // }
} // }
func (self *EthereumApi) start() { func (self *EthereumApi) start() {
timer := time.NewTicker(filterTickerTime) timer := time.NewTicker(filterTickerTime)
events := self.mux.Subscribe(core.ChainEvent{}) // events := self.mux.Subscribe(core.ChainEvent{})
done: done:
for { for {
select { select {
case ev := <-events.Chan(): // case ev := <-events.Chan():
switch ev.(type) { // switch ev.(type) {
case core.ChainEvent: // case core.ChainEvent:
if self.defaultBlockAge < 0 { // if self.defaultBlockAge < 0 {
self.setStateByBlockNumber(self.defaultBlockAge) // self.setStateByBlockNumber(self.defaultBlockAge)
} // }
} // }
case <-timer.C: case <-timer.C:
self.logMut.Lock() self.logMut.Lock()
self.messagesMut.Lock() self.messagesMut.Lock()
@ -365,24 +365,6 @@ func (p *EthereumApi) GetIsMining(reply *interface{}) error {
return nil 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 { func (p *EthereumApi) BlockNumber(reply *interface{}) error {
*reply = p.xeth().Backend().ChainManager().CurrentBlock().Number() *reply = p.xeth().Backend().ChainManager().CurrentBlock().Number()
return nil return nil
@ -515,20 +497,6 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return p.GetCoinbase(reply) return p.GetCoinbase(reply)
case "eth_mining": case "eth_mining":
return p.GetIsMining(reply) 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": case "eth_number":
return p.BlockNumber(reply) return p.BlockNumber(reply)
case "eth_accounts": case "eth_accounts":