mirror of https://github.com/status-im/op-geth.git
Stub defaultBlock methods
This commit is contained in:
parent
52ccaa605e
commit
9e0ab22dd0
21
rpc/api.go
21
rpc/api.go
|
@ -45,6 +45,8 @@ type EthereumApi struct {
|
||||||
register map[string][]*NewTxArgs
|
register map[string][]*NewTxArgs
|
||||||
|
|
||||||
db ethutil.Database
|
db ethutil.Database
|
||||||
|
|
||||||
|
defaultBlockAge int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEthereumApi(eth *xeth.XEth) *EthereumApi {
|
func NewEthereumApi(eth *xeth.XEth) *EthereumApi {
|
||||||
|
@ -318,6 +320,17 @@ func (p *EthereumApi) SetMining(shouldmine bool, reply *interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *EthereumApi) GetDefaultBlockAge(reply *interface{}) error {
|
||||||
|
*reply = p.defaultBlockAge
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *EthereumApi) SetDefaultBlockAge(defaultBlockAge int, reply *interface{}) error {
|
||||||
|
p.defaultBlockAge = 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
|
||||||
|
@ -458,6 +471,14 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return p.SetMining(args, reply)
|
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(args, reply)
|
||||||
case "eth_peerCount":
|
case "eth_peerCount":
|
||||||
return p.GetPeerCount(reply)
|
return p.GetPeerCount(reply)
|
||||||
case "eth_number":
|
case "eth_number":
|
||||||
|
|
|
@ -210,6 +210,19 @@ func (req *RpcRequest) ToBoolArgs() (bool, error) {
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (req *RpcRequest) ToIntArgs() (int, error) {
|
||||||
|
if len(req.Params) < 1 {
|
||||||
|
return 0, errArguments
|
||||||
|
}
|
||||||
|
|
||||||
|
var args int
|
||||||
|
if err := json.Unmarshal(req.Params[0], &args); err != nil {
|
||||||
|
return 0, errArguments
|
||||||
|
}
|
||||||
|
|
||||||
|
return args, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (req *RpcRequest) ToCompileArgs() (string, error) {
|
func (req *RpcRequest) ToCompileArgs() (string, error) {
|
||||||
if len(req.Params) < 1 {
|
if len(req.Params) < 1 {
|
||||||
return "", errArguments
|
return "", errArguments
|
||||||
|
|
Loading…
Reference in New Issue