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
6dfbbc3e
Commit
6dfbbc3e
authored
Nov 03, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1948 from bas-vk/rpcfix
Infinite loop in filters
parents
5ff0814b
76410df6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
args_test.go
rpc/api/args_test.go
+5
-7
eth_args.go
rpc/api/eth_args.go
+7
-0
No files found.
rpc/api/args_test.go
View file @
6dfbbc3e
...
...
@@ -1394,13 +1394,10 @@ func TestBlockFilterArgsDefaults(t *testing.T) {
}
func
TestBlockFilterArgsWords
(
t
*
testing
.
T
)
{
input
:=
`[{
"fromBlock": "latest",
"toBlock": "pending"
}]`
input
:=
`[{"fromBlock": "latest", "toBlock": "latest"}]`
expected
:=
new
(
BlockFilterArgs
)
expected
.
Earliest
=
-
1
expected
.
Latest
=
-
2
expected
.
Latest
=
-
1
args
:=
new
(
BlockFilterArgs
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
...
...
@@ -1411,8 +1408,9 @@ func TestBlockFilterArgsWords(t *testing.T) {
t
.
Errorf
(
"Earliest shoud be %#v but is %#v"
,
expected
.
Earliest
,
args
.
Earliest
)
}
if
expected
.
Latest
!=
args
.
Latest
{
t
.
Errorf
(
"Latest shoud be %#v but is %#v"
,
expected
.
Latest
,
args
.
Latest
)
input
=
`[{"toBlock": "pending"}]`
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
==
nil
{
t
.
Errorf
(
"Pending isn't currently supported and should raise an unsupported error"
)
}
}
...
...
rpc/api/eth_args.go
View file @
6dfbbc3e
...
...
@@ -722,6 +722,13 @@ func (args *BlockFilterArgs) UnmarshalJSON(b []byte) (err error) {
return
err
}
}
if
num
==
-
2
{
return
fmt
.
Errorf
(
"
\"
pending
\"
is unsupported"
)
}
else
if
num
<
-
2
{
return
fmt
.
Errorf
(
"Invalid to block number"
)
}
args
.
Latest
=
num
if
obj
[
0
]
.
Limit
==
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