diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-04-02 21:53:04 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-04-02 21:53:04 +0800 |
commit | aa71e27a3b0f42b980082c52232c68fb50a45052 (patch) | |
tree | 544c33d6af9d5657d8a422d218a8b9883f059765 /rpc | |
parent | 39085905783829161738207271aa35386f6ebc72 (diff) | |
download | dexon-aa71e27a3b0f42b980082c52232c68fb50a45052.tar.gz dexon-aa71e27a3b0f42b980082c52232c68fb50a45052.tar.zst dexon-aa71e27a3b0f42b980082c52232c68fb50a45052.zip |
Detect non-valid strings for blockheight
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/args.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rpc/args.go b/rpc/args.go index a8cb7dcb1..cebabf4ba 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -41,7 +41,11 @@ func blockHeight(raw interface{}, number *int64) error { case "pending": *number = -2 default: - *number = common.String2Big(str).Int64() + if common.HasHexPrefix(str) { + *number = common.String2Big(str).Int64() + } else { + return NewInvalidTypeError("blockNumber", "is not a valid string") + } } return nil |