Index is zero-based #607
This commit is contained in:
parent
81aeb78976
commit
8f0e095f4c
@ -213,7 +213,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
|
|||||||
br := NewBlockRes(block)
|
br := NewBlockRes(block)
|
||||||
br.fullTx = true
|
br.fullTx = true
|
||||||
|
|
||||||
if args.Index > int64(len(br.Transactions)) || args.Index < 0 {
|
if args.Index >= int64(len(br.Transactions)) || args.Index < 0 {
|
||||||
return NewValidationError("Index", "does not exist")
|
return NewValidationError("Index", "does not exist")
|
||||||
}
|
}
|
||||||
*reply = br.Transactions[args.Index]
|
*reply = br.Transactions[args.Index]
|
||||||
@ -227,7 +227,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
|
|||||||
v := NewBlockRes(block)
|
v := NewBlockRes(block)
|
||||||
v.fullTx = true
|
v.fullTx = true
|
||||||
|
|
||||||
if args.Index > int64(len(v.Transactions)) || args.Index < 0 {
|
if args.Index >= int64(len(v.Transactions)) || args.Index < 0 {
|
||||||
return NewValidationError("Index", "does not exist")
|
return NewValidationError("Index", "does not exist")
|
||||||
}
|
}
|
||||||
*reply = v.Transactions[args.Index]
|
*reply = v.Transactions[args.Index]
|
||||||
@ -239,7 +239,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
|
|||||||
|
|
||||||
br := NewBlockRes(api.xeth().EthBlockByHash(args.Hash))
|
br := NewBlockRes(api.xeth().EthBlockByHash(args.Hash))
|
||||||
|
|
||||||
if args.Index > int64(len(br.Uncles)) || args.Index < 0 {
|
if args.Index >= int64(len(br.Uncles)) || args.Index < 0 {
|
||||||
return NewValidationError("Index", "does not exist")
|
return NewValidationError("Index", "does not exist")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
|
|||||||
v := NewBlockRes(block)
|
v := NewBlockRes(block)
|
||||||
v.fullTx = true
|
v.fullTx = true
|
||||||
|
|
||||||
if args.Index > int64(len(v.Uncles)) || args.Index < 0 {
|
if args.Index >= int64(len(v.Uncles)) || args.Index < 0 {
|
||||||
return NewValidationError("Index", "does not exist")
|
return NewValidationError("Index", "does not exist")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user