aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-31 23:56:06 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-31 23:56:06 +0800
commit8f0e095f4c269c48ac2c182c891e6346929de57b (patch)
tree87472215e2df063b79f1755df1c3cc43a140d1ca
parent81aeb789765cde7d84dc8aa74a6cab0851ce8503 (diff)
downloaddexon-8f0e095f4c269c48ac2c182c891e6346929de57b.tar.gz
dexon-8f0e095f4c269c48ac2c182c891e6346929de57b.tar.zst
dexon-8f0e095f4c269c48ac2c182c891e6346929de57b.zip
Index is zero-based #607
-rw-r--r--rpc/api.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 502079177..bce9a46e7 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -213,7 +213,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
br := NewBlockRes(block)
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")
}
*reply = br.Transactions[args.Index]
@@ -227,7 +227,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
v := NewBlockRes(block)
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")
}
*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))
- 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")
}
@@ -257,7 +257,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
v := NewBlockRes(block)
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")
}