good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
76410df6
Commit
76410df6
authored
Oct 29, 2015
by
Bas van Kervel
Browse files
Options
Downloads
Patches
Plain Diff
rpc: return an unsupported error when "pending" was used to create a filter
parent
56f8699a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
rpc/api/args_test.go
+5
-7
5 additions, 7 deletions
rpc/api/args_test.go
rpc/api/eth_args.go
+7
-0
7 additions, 0 deletions
rpc/api/eth_args.go
with
12 additions
and
7 deletions
rpc/api/args_test.go
+
5
−
7
View file @
76410df6
...
@@ -1394,13 +1394,10 @@ func TestBlockFilterArgsDefaults(t *testing.T) {
...
@@ -1394,13 +1394,10 @@ func TestBlockFilterArgsDefaults(t *testing.T) {
}
}
func
TestBlockFilterArgsWords
(
t
*
testing
.
T
)
{
func
TestBlockFilterArgsWords
(
t
*
testing
.
T
)
{
input
:=
`[{
input
:=
`[{"fromBlock": "latest", "toBlock": "latest"}]`
"fromBlock": "latest",
"toBlock": "pending"
}]`
expected
:=
new
(
BlockFilterArgs
)
expected
:=
new
(
BlockFilterArgs
)
expected
.
Earliest
=
-
1
expected
.
Earliest
=
-
1
expected
.
Latest
=
-
2
expected
.
Latest
=
-
1
args
:=
new
(
BlockFilterArgs
)
args
:=
new
(
BlockFilterArgs
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
...
@@ -1411,8 +1408,9 @@ func TestBlockFilterArgsWords(t *testing.T) {
...
@@ -1411,8 +1408,9 @@ func TestBlockFilterArgsWords(t *testing.T) {
t
.
Errorf
(
"Earliest shoud be %#v but is %#v"
,
expected
.
Earliest
,
args
.
Earliest
)
t
.
Errorf
(
"Earliest shoud be %#v but is %#v"
,
expected
.
Earliest
,
args
.
Earliest
)
}
}
if
expected
.
Latest
!=
args
.
Latest
{
input
=
`[{"toBlock": "pending"}]`
t
.
Errorf
(
"Latest shoud be %#v but is %#v"
,
expected
.
Latest
,
args
.
Latest
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
==
nil
{
t
.
Errorf
(
"Pending isn't currently supported and should raise an unsupported error"
)
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
rpc/api/eth_args.go
+
7
−
0
View file @
76410df6
...
@@ -714,6 +714,13 @@ func (args *BlockFilterArgs) UnmarshalJSON(b []byte) (err error) {
...
@@ -714,6 +714,13 @@ func (args *BlockFilterArgs) UnmarshalJSON(b []byte) (err error) {
return
err
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
args
.
Latest
=
num
if
obj
[
0
]
.
Limit
==
nil
{
if
obj
[
0
]
.
Limit
==
nil
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment