mirror of https://github.com/status-im/op-geth.git
Inline getStateWithNum
This commit is contained in:
parent
abc3d8d50a
commit
6cc02aadbf
12
rpc/api.go
12
rpc/api.go
|
@ -81,10 +81,6 @@ func (self *EthereumApi) xethWithStateNum(num int64) *xeth.XEth {
|
||||||
return self.xeth().WithState(st)
|
return self.xeth().WithState(st)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *EthereumApi) getStateWithNum(num int64) *xeth.State {
|
|
||||||
return self.xethWithStateNum(num).State()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *EthereumApi) start() {
|
func (self *EthereumApi) start() {
|
||||||
timer := time.NewTicker(filterTickerTime)
|
timer := time.NewTicker(filterTickerTime)
|
||||||
done:
|
done:
|
||||||
|
@ -290,8 +286,7 @@ func (p *EthereumApi) GetBalance(args *GetBalanceArgs, reply *interface{}) error
|
||||||
if err := args.requirements(); err != nil {
|
if err := args.requirements(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
state := p.getStateWithNum(args.BlockNumber).SafeGet(args.Address)
|
*reply = common.ToHex(p.xethWithStateNum(args.BlockNumber).State().SafeGet(args.Address).Balance().Bytes())
|
||||||
*reply = common.ToHex(state.Balance().Bytes())
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +294,7 @@ func (p *EthereumApi) GetStorage(args *GetStorageArgs, reply *interface{}) error
|
||||||
if err := args.requirements(); err != nil {
|
if err := args.requirements(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
*reply = p.getStateWithNum(args.BlockNumber).SafeGet(args.Address).Storage()
|
*reply = p.xethWithStateNum(args.BlockNumber).State().SafeGet(args.Address).Storage()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,9 +302,10 @@ func (p *EthereumApi) GetStorageAt(args *GetStorageAtArgs, reply *interface{}) e
|
||||||
if err := args.requirements(); err != nil {
|
if err := args.requirements(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
state := p.getStateWithNum(args.BlockNumber).SafeGet(args.Address)
|
|
||||||
|
|
||||||
|
state := p.xethWithStateNum(args.BlockNumber).State().SafeGet(args.Address)
|
||||||
value := state.StorageString(args.Key)
|
value := state.StorageString(args.Key)
|
||||||
|
|
||||||
var hx string
|
var hx string
|
||||||
if strings.Index(args.Key, "0x") == 0 {
|
if strings.Index(args.Key, "0x") == 0 {
|
||||||
hx = string([]byte(args.Key)[2:])
|
hx = string([]byte(args.Key)[2:])
|
||||||
|
|
Loading…
Reference in New Issue