aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-27 05:42:46 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-27 05:42:46 +0800
commit6bd1f6cc49acd459e61559e5af515da2db2481e5 (patch)
tree3e4f7a51ca8e3cb03d24fbe1898578d88fd7456c /rpc
parentbb12dbe233db2e064715b329b7ba987c76ba3bfa (diff)
parentb0b0939879b9fb8453ec1c8fa2ceb522e56df3bc (diff)
downloaddexon-6bd1f6cc49acd459e61559e5af515da2db2481e5.tar
dexon-6bd1f6cc49acd459e61559e5af515da2db2481e5.tar.gz
dexon-6bd1f6cc49acd459e61559e5af515da2db2481e5.tar.bz2
dexon-6bd1f6cc49acd459e61559e5af515da2db2481e5.tar.lz
dexon-6bd1f6cc49acd459e61559e5af515da2db2481e5.tar.xz
dexon-6bd1f6cc49acd459e61559e5af515da2db2481e5.tar.zst
dexon-6bd1f6cc49acd459e61559e5af515da2db2481e5.zip
Merge remote-tracking branch 'origin' into rpcargs
Conflicts: rpc/args.go
Diffstat (limited to 'rpc')
-rw-r--r--rpc/args.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/rpc/args.go b/rpc/args.go
index 416c672b0..65707aa37 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -3,6 +3,8 @@ package rpc
import (
"bytes"
"encoding/json"
+ // "errors"
+ // "fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
@@ -60,6 +62,26 @@ func numString(raw interface{}, number *int64) error {
return nil
}
+// func toNumber(v interface{}) (int64, error) {
+// var str string
+// if v != nil {
+// var ok bool
+// str, ok = v.(string)
+// if !ok {
+// return 0, errors.New("is not a string or undefined")
+// }
+// } else {
+// str = "latest"
+// }
+
+// switch str {
+// case "latest":
+// return -1, nil
+// default:
+// return int64(common.Big(v.(string)).Int64()), nil
+// }
+// }
+
type GetBlockByHashArgs struct {
BlockHash string
IncludeTxs bool
@@ -442,6 +464,14 @@ func (args *BlockFilterArgs) UnmarshalJSON(b []byte) (err error) {
return NewInsufficientParamsError(len(obj), 1)
}
+ // args.Earliest, err = toNumber(obj[0].ToBlock)
+ // if err != nil {
+ // return NewDecodeParamError(fmt.Sprintf("FromBlock %v", err))
+ // }
+ // args.Latest, err = toNumber(obj[0].FromBlock)
+ // if err != nil {
+ // return NewDecodeParamError(fmt.Sprintf("ToBlock %v", err))
+
var num int64
if err := blockHeight(obj[0].FromBlock, &num); err != nil {
return err
@@ -464,6 +494,7 @@ func (args *BlockFilterArgs) UnmarshalJSON(b []byte) (err error) {
if err := numString(obj[0].Offset, &num); err != nil {
return err
+
}
args.Skip = int(num)