Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
aa71e27a
Commit
aa71e27a
authored
Apr 02, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect non-valid strings for blockheight
parent
39085905
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
bytes.go
common/bytes.go
+5
-0
args.go
rpc/args.go
+5
-1
No files found.
common/bytes.go
View file @
aa71e27a
...
...
@@ -127,6 +127,11 @@ func CopyBytes(b []byte) (copiedBytes []byte) {
return
}
func
HasHexPrefix
(
str
string
)
bool
{
l
:=
len
(
str
)
return
l
>=
2
&&
str
[
0
:
2
]
==
"0x"
}
func
IsHex
(
str
string
)
bool
{
l
:=
len
(
str
)
return
l
>=
4
&&
l
%
2
==
0
&&
str
[
0
:
2
]
==
"0x"
...
...
rpc/args.go
View file @
aa71e27a
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment