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
6661bc35
Commit
6661bc35
authored
Mar 26, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept number or string for BlockFilterArgs to/fromBlock
parent
745dd5b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
args.go
rpc/args.go
+11
-8
args_test.go
rpc/args_test.go
+3
-3
No files found.
rpc/args.go
View file @
6661bc35
...
@@ -424,17 +424,20 @@ func (args *BlockFilterArgs) UnmarshalJSON(b []byte) (err error) {
...
@@ -424,17 +424,20 @@ func (args *BlockFilterArgs) UnmarshalJSON(b []byte) (err error) {
return
NewInsufficientParamsError
(
len
(
obj
),
1
)
return
NewInsufficientParamsError
(
len
(
obj
),
1
)
}
}
fromstr
,
ok
:=
obj
[
0
]
.
FromBlock
.
(
string
)
var
num
int64
if
!
ok
{
if
err
:=
blockHeight
(
obj
[
0
]
.
FromBlock
,
&
num
);
err
!=
nil
{
return
NewInvalidTypeError
(
"fromBlock"
,
"is not a string"
)
return
err
}
if
num
<
0
{
args
.
Earliest
=
-
1
//latest block
}
else
{
args
.
Earliest
=
num
}
}
switch
fromstr
{
if
err
:=
blockHeight
(
obj
[
0
]
.
ToBlock
,
&
num
);
err
!=
nil
{
case
"latest"
:
return
err
args
.
Earliest
=
-
1
default
:
args
.
Earliest
=
int64
(
common
.
Big
(
obj
[
0
]
.
FromBlock
.
(
string
))
.
Int64
())
}
}
args
.
Latest
=
num
tostr
,
ok
:=
obj
[
0
]
.
ToBlock
.
(
string
)
tostr
,
ok
:=
obj
[
0
]
.
ToBlock
.
(
string
)
if
!
ok
{
if
!
ok
{
...
...
rpc/args_test.go
View file @
6661bc35
...
@@ -759,10 +759,10 @@ func TestBlockFilterArgsWords(t *testing.T) {
...
@@ -759,10 +759,10 @@ func TestBlockFilterArgsWords(t *testing.T) {
}
}
}
}
func
TestBlockFilterArgs
Nums
(
t
*
testing
.
T
)
{
func
TestBlockFilterArgs
Bool
(
t
*
testing
.
T
)
{
input
:=
`[{
input
:=
`[{
"fromBlock":
2
,
"fromBlock":
true
,
"toBlock":
3
"toBlock":
false
}]`
}]`
args
:=
new
(
BlockFilterArgs
)
args
:=
new
(
BlockFilterArgs
)
...
...
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