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
3cea7d87
Commit
3cea7d87
authored
Mar 20, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename FilterOptions to BlockFilterArgs
parent
d791fe49
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
15 deletions
+15
-15
api.go
rpc/api.go
+3
-3
args.go
rpc/args.go
+2
-2
args_test.go
rpc/args_test.go
+10
-10
No files found.
rpc/api.go
View file @
3cea7d87
...
@@ -406,7 +406,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -406,7 +406,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
case
"eth_compileSolidity"
,
"eth_compileLLL"
,
"eth_compileSerpent"
:
case
"eth_compileSolidity"
,
"eth_compileLLL"
,
"eth_compileSerpent"
:
return
NewNotImplementedError
(
req
.
Method
)
return
NewNotImplementedError
(
req
.
Method
)
case
"eth_newFilter"
:
case
"eth_newFilter"
:
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -444,7 +444,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -444,7 +444,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
}
}
*
reply
=
NewLogsRes
(
p
.
xeth
()
.
Logs
(
args
.
Id
))
*
reply
=
NewLogsRes
(
p
.
xeth
()
.
Logs
(
args
.
Id
))
case
"eth_getLogs"
:
case
"eth_getLogs"
:
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -561,7 +561,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -561,7 +561,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
nil
return
nil
}
}
func
toFilterOptions
(
options
*
FilterOption
s
)
*
core
.
FilterOptions
{
func
toFilterOptions
(
options
*
BlockFilterArg
s
)
*
core
.
FilterOptions
{
var
opts
core
.
FilterOptions
var
opts
core
.
FilterOptions
// Convert optional address slice/string to byte slice
// Convert optional address slice/string to byte slice
...
...
rpc/args.go
View file @
3cea7d87
...
@@ -433,7 +433,7 @@ func (args *Sha3Args) UnmarshalJSON(b []byte) (err error) {
...
@@ -433,7 +433,7 @@ func (args *Sha3Args) UnmarshalJSON(b []byte) (err error) {
return
nil
return
nil
}
}
type
FilterOption
s
struct
{
type
BlockFilterArg
s
struct
{
Earliest
int64
Earliest
int64
Latest
int64
Latest
int64
Address
interface
{}
Address
interface
{}
...
@@ -442,7 +442,7 @@ type FilterOptions struct {
...
@@ -442,7 +442,7 @@ type FilterOptions struct {
Max
int
Max
int
}
}
func
(
args
*
FilterOption
s
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
func
(
args
*
BlockFilterArg
s
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
struct
{
var
obj
[]
struct
{
FromBlock
interface
{}
`json:"fromBlock"`
FromBlock
interface
{}
`json:"fromBlock"`
ToBlock
interface
{}
`json:"toBlock"`
ToBlock
interface
{}
`json:"toBlock"`
...
...
rpc/args_test.go
View file @
3cea7d87
...
@@ -388,7 +388,7 @@ func TestGetDataEmptyArgs(t *testing.T) {
...
@@ -388,7 +388,7 @@ func TestGetDataEmptyArgs(t *testing.T) {
}
}
}
}
func
Test
FilterOption
s
(
t
*
testing
.
T
)
{
func
Test
BlockFilterArg
s
(
t
*
testing
.
T
)
{
input
:=
`[{
input
:=
`[{
"fromBlock": "0x1",
"fromBlock": "0x1",
"toBlock": "0x2",
"toBlock": "0x2",
...
@@ -396,7 +396,7 @@ func TestFilterOptions(t *testing.T) {
...
@@ -396,7 +396,7 @@ func TestFilterOptions(t *testing.T) {
"offset": "0x0",
"offset": "0x0",
"address": "0xd5677cf67b5aa051bb40496e68ad359eb97cfbf8",
"address": "0xd5677cf67b5aa051bb40496e68ad359eb97cfbf8",
"topics": ["0x12341234"]}]`
"topics": ["0x12341234"]}]`
expected
:=
new
(
FilterOption
s
)
expected
:=
new
(
BlockFilterArg
s
)
expected
.
Earliest
=
1
expected
.
Earliest
=
1
expected
.
Latest
=
2
expected
.
Latest
=
2
expected
.
Max
=
3
expected
.
Max
=
3
...
@@ -404,7 +404,7 @@ func TestFilterOptions(t *testing.T) {
...
@@ -404,7 +404,7 @@ func TestFilterOptions(t *testing.T) {
expected
.
Address
=
"0xd5677cf67b5aa051bb40496e68ad359eb97cfbf8"
expected
.
Address
=
"0xd5677cf67b5aa051bb40496e68ad359eb97cfbf8"
// expected.Topics = []string{"0x12341234"}
// expected.Topics = []string{"0x12341234"}
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
...
@@ -434,16 +434,16 @@ func TestFilterOptions(t *testing.T) {
...
@@ -434,16 +434,16 @@ func TestFilterOptions(t *testing.T) {
// }
// }
}
}
func
Test
FilterOption
sWords
(
t
*
testing
.
T
)
{
func
Test
BlockFilterArg
sWords
(
t
*
testing
.
T
)
{
input
:=
`[{
input
:=
`[{
"fromBlock": "latest",
"fromBlock": "latest",
"toBlock": "pending"
"toBlock": "pending"
}]`
}]`
expected
:=
new
(
FilterOption
s
)
expected
:=
new
(
BlockFilterArg
s
)
expected
.
Earliest
=
0
expected
.
Earliest
=
0
expected
.
Latest
=
-
1
expected
.
Latest
=
-
1
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
...
@@ -457,13 +457,13 @@ func TestFilterOptionsWords(t *testing.T) {
...
@@ -457,13 +457,13 @@ func TestFilterOptionsWords(t *testing.T) {
}
}
}
}
func
Test
FilterOption
sNums
(
t
*
testing
.
T
)
{
func
Test
BlockFilterArg
sNums
(
t
*
testing
.
T
)
{
input
:=
`[{
input
:=
`[{
"fromBlock": 2,
"fromBlock": 2,
"toBlock": 3
"toBlock": 3
}]`
}]`
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
)
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
)
switch
err
.
(
type
)
{
switch
err
.
(
type
)
{
case
*
DecodeParamError
:
case
*
DecodeParamError
:
...
@@ -474,10 +474,10 @@ func TestFilterOptionsNums(t *testing.T) {
...
@@ -474,10 +474,10 @@ func TestFilterOptionsNums(t *testing.T) {
}
}
func
Test
FilterOption
sEmptyArgs
(
t
*
testing
.
T
)
{
func
Test
BlockFilterArg
sEmptyArgs
(
t
*
testing
.
T
)
{
input
:=
`[]`
input
:=
`[]`
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
)
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
)
if
err
==
nil
{
if
err
==
nil
{
t
.
Error
(
"Expected error but didn't get one"
)
t
.
Error
(
"Expected error but didn't get one"
)
...
...
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