Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
3cea7d87
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3cea7d87
编写于
3月 19, 2015
作者:
T
Taylor Gerring
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename FilterOptions to BlockFilterArgs
上级
d791fe49
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
15 deletion
+15
-15
rpc/api.go
rpc/api.go
+3
-3
rpc/args.go
rpc/args.go
+2
-2
rpc/args_test.go
rpc/args_test.go
+10
-10
未找到文件。
rpc/api.go
浏览文件 @
3cea7d87
...
...
@@ -406,7 +406,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
case
"eth_compileSolidity"
,
"eth_compileLLL"
,
"eth_compileSerpent"
:
return
NewNotImplementedError
(
req
.
Method
)
case
"eth_newFilter"
:
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
}
...
...
@@ -444,7 +444,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
}
*
reply
=
NewLogsRes
(
p
.
xeth
()
.
Logs
(
args
.
Id
))
case
"eth_getLogs"
:
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
}
...
...
@@ -561,7 +561,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
nil
}
func
toFilterOptions
(
options
*
FilterOption
s
)
*
core
.
FilterOptions
{
func
toFilterOptions
(
options
*
BlockFilterArg
s
)
*
core
.
FilterOptions
{
var
opts
core
.
FilterOptions
// Convert optional address slice/string to byte slice
...
...
rpc/args.go
浏览文件 @
3cea7d87
...
...
@@ -433,7 +433,7 @@ func (args *Sha3Args) UnmarshalJSON(b []byte) (err error) {
return
nil
}
type
FilterOption
s
struct
{
type
BlockFilterArg
s
struct
{
Earliest
int64
Latest
int64
Address
interface
{}
...
...
@@ -442,7 +442,7 @@ type FilterOptions struct {
Max
int
}
func
(
args
*
FilterOption
s
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
func
(
args
*
BlockFilterArg
s
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
struct
{
FromBlock
interface
{}
`json:"fromBlock"`
ToBlock
interface
{}
`json:"toBlock"`
...
...
rpc/args_test.go
浏览文件 @
3cea7d87
...
...
@@ -388,7 +388,7 @@ func TestGetDataEmptyArgs(t *testing.T) {
}
}
func
Test
FilterOption
s
(
t
*
testing
.
T
)
{
func
Test
BlockFilterArg
s
(
t
*
testing
.
T
)
{
input
:=
`[{
"fromBlock": "0x1",
"toBlock": "0x2",
...
...
@@ -396,7 +396,7 @@ func TestFilterOptions(t *testing.T) {
"offset": "0x0",
"address": "0xd5677cf67b5aa051bb40496e68ad359eb97cfbf8",
"topics": ["0x12341234"]}]`
expected
:=
new
(
FilterOption
s
)
expected
:=
new
(
BlockFilterArg
s
)
expected
.
Earliest
=
1
expected
.
Latest
=
2
expected
.
Max
=
3
...
...
@@ -404,7 +404,7 @@ func TestFilterOptions(t *testing.T) {
expected
.
Address
=
"0xd5677cf67b5aa051bb40496e68ad359eb97cfbf8"
// expected.Topics = []string{"0x12341234"}
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
t
.
Error
(
err
)
}
...
...
@@ -434,16 +434,16 @@ func TestFilterOptions(t *testing.T) {
// }
}
func
Test
FilterOption
sWords
(
t
*
testing
.
T
)
{
func
Test
BlockFilterArg
sWords
(
t
*
testing
.
T
)
{
input
:=
`[{
"fromBlock": "latest",
"toBlock": "pending"
}]`
expected
:=
new
(
FilterOption
s
)
expected
:=
new
(
BlockFilterArg
s
)
expected
.
Earliest
=
0
expected
.
Latest
=
-
1
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
t
.
Error
(
err
)
}
...
...
@@ -457,13 +457,13 @@ func TestFilterOptionsWords(t *testing.T) {
}
}
func
Test
FilterOption
sNums
(
t
*
testing
.
T
)
{
func
Test
BlockFilterArg
sNums
(
t
*
testing
.
T
)
{
input
:=
`[{
"fromBlock": 2,
"toBlock": 3
}]`
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
)
switch
err
.
(
type
)
{
case
*
DecodeParamError
:
...
...
@@ -474,10 +474,10 @@ func TestFilterOptionsNums(t *testing.T) {
}
func
Test
FilterOption
sEmptyArgs
(
t
*
testing
.
T
)
{
func
Test
BlockFilterArg
sEmptyArgs
(
t
*
testing
.
T
)
{
input
:=
`[]`
args
:=
new
(
FilterOption
s
)
args
:=
new
(
BlockFilterArg
s
)
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
)
if
err
==
nil
{
t
.
Error
(
"Expected error but didn't get one"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录