Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
2da7af4b
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,体验更适合开发者的 AI 搜索 >>
提交
2da7af4b
编写于
3月 11, 2015
作者:
O
obscuren
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'rpcfrontier' of github.com-obscure:ethereum/go-ethereum into rpcfrontier
上级
e8d1b622
90f34ed4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
56 addition
and
15 deletion
+56
-15
rpc/api.go
rpc/api.go
+41
-6
rpc/args.go
rpc/args.go
+11
-6
rpc/args_test.go
rpc/args_test.go
+3
-3
rpc/responses.go
rpc/responses.go
+1
-0
未找到文件。
rpc/api.go
浏览文件 @
2da7af4b
...
...
@@ -394,7 +394,7 @@ func (self *EthereumApi) MessagesChanged(id int, reply *interface{}) error {
}
func
(
p
*
EthereumApi
)
WhisperPost
(
args
*
WhisperMessageArgs
,
reply
*
interface
{})
error
{
err
:=
p
.
xeth
()
.
Whisper
()
.
Post
(
args
.
Payload
,
args
.
To
,
args
.
From
,
args
.
Topic
,
args
.
Priority
,
args
.
Ttl
)
err
:=
p
.
xeth
()
.
Whisper
()
.
Post
(
args
.
Payload
,
args
.
To
,
args
.
From
,
args
.
Topic
s
,
args
.
Priority
,
args
.
Ttl
)
if
err
!=
nil
{
return
err
}
...
...
@@ -597,10 +597,10 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
if
err
!=
nil
{
return
err
}
if
args
.
TxIndex
>
int64
(
len
(
v
.
Transactions
))
||
args
.
Tx
Index
<
0
{
if
args
.
Index
>
int64
(
len
(
v
.
Transactions
))
||
args
.
Index
<
0
{
return
NewErrorWithMessage
(
errDecodeArgs
,
"Transaction index does not exist"
)
}
*
reply
=
v
.
Transactions
[
args
.
Tx
Index
]
*
reply
=
v
.
Transactions
[
args
.
Index
]
case
"eth_getTransactionByBlockNumberAndIndex"
:
args
:=
new
(
BlockNumIndexArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
...
@@ -611,13 +611,48 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
if
err
!=
nil
{
return
err
}
if
args
.
TxIndex
>
int64
(
len
(
v
.
Transactions
))
||
args
.
Tx
Index
<
0
{
if
args
.
Index
>
int64
(
len
(
v
.
Transactions
))
||
args
.
Index
<
0
{
return
NewErrorWithMessage
(
errDecodeArgs
,
"Transaction index does not exist"
)
}
*
reply
=
v
.
Transactions
[
args
.
Tx
Index
]
*
reply
=
v
.
Transactions
[
args
.
Index
]
case
"eth_getUncleByBlockHashAndIndex"
:
args
:=
new
(
HashIndexArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
}
v
,
err
:=
p
.
GetBlockByHash
(
args
.
BlockHash
,
false
)
if
err
!=
nil
{
return
err
}
if
args
.
Index
>
int64
(
len
(
v
.
Uncles
))
||
args
.
Index
<
0
{
return
NewErrorWithMessage
(
errDecodeArgs
,
"Uncle index does not exist"
)
}
uncle
,
err
:=
p
.
GetBlockByHash
(
toHex
(
v
.
Uncles
[
args
.
Index
]),
false
)
if
err
!=
nil
{
return
err
}
*
reply
=
uncle
case
"eth_getUncleByBlockNumberAndIndex"
:
return
errNotImplemented
args
:=
new
(
BlockNumIndexArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
}
v
,
err
:=
p
.
GetBlockByNumber
(
args
.
BlockNumber
,
true
)
if
err
!=
nil
{
return
err
}
if
args
.
Index
>
int64
(
len
(
v
.
Uncles
))
||
args
.
Index
<
0
{
return
NewErrorWithMessage
(
errDecodeArgs
,
"Uncle index does not exist"
)
}
uncle
,
err
:=
p
.
GetBlockByHash
(
toHex
(
v
.
Uncles
[
args
.
Index
]),
false
)
if
err
!=
nil
{
return
err
}
*
reply
=
uncle
case
"eth_getCompilers"
:
return
p
.
GetCompilers
(
reply
)
case
"eth_compileSolidity"
:
...
...
rpc/args.go
浏览文件 @
2da7af4b
...
...
@@ -40,7 +40,12 @@ func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) {
if
len
(
obj
)
<
1
{
return
errArguments
}
args
.
BlockHash
=
obj
[
0
]
.
(
string
)
argstr
,
ok
:=
obj
[
0
]
.
(
string
)
if
!
ok
{
return
errDecodeArgs
}
args
.
BlockHash
=
argstr
if
len
(
obj
)
>
1
{
args
.
Transactions
=
obj
[
1
]
.
(
bool
)
...
...
@@ -219,12 +224,12 @@ func (args *GetDataArgs) requirements() error {
type
BlockNumIndexArgs
struct
{
BlockNumber
int64
TxIndex
int64
Index
int64
}
type
HashIndexArgs
struct
{
BlockHash
string
TxIndex
int64
Index
int64
}
type
Sha3Args
struct
{
...
...
@@ -362,7 +367,7 @@ type WhisperMessageArgs struct {
Payload
string
To
string
From
string
Topic
[]
string
Topic
s
[]
string
Priority
uint32
Ttl
uint32
}
...
...
@@ -372,7 +377,7 @@ func (args *WhisperMessageArgs) UnmarshalJSON(b []byte) (err error) {
Payload
string
To
string
From
string
Topic
[]
string
Topic
s
[]
string
Priority
string
Ttl
string
}
...
...
@@ -387,7 +392,7 @@ func (args *WhisperMessageArgs) UnmarshalJSON(b []byte) (err error) {
args
.
Payload
=
obj
[
0
]
.
Payload
args
.
To
=
obj
[
0
]
.
To
args
.
From
=
obj
[
0
]
.
From
args
.
Topic
=
obj
[
0
]
.
Topic
args
.
Topic
s
=
obj
[
0
]
.
Topics
args
.
Priority
=
uint32
(
ethutil
.
Big
(
obj
[
0
]
.
Priority
)
.
Int64
())
args
.
Ttl
=
uint32
(
ethutil
.
Big
(
obj
[
0
]
.
Ttl
)
.
Int64
())
...
...
rpc/args_test.go
浏览文件 @
2da7af4b
...
...
@@ -270,7 +270,7 @@ func TestFilterOptions(t *testing.T) {
t
.
Errorf
(
"Address shoud be %#v but is %#v"
,
expected
.
Address
,
args
.
Address
)
}
// if expected.Topic
!= args.Topic
{
// if expected.Topic
s != args.Topics
{
// t.Errorf("Topic shoud be %#v but is %#v", expected.Topic, args.Topic)
// }
}
...
...
@@ -316,7 +316,7 @@ func TestWhisperMessageArgs(t *testing.T) {
expected
.
Payload
=
"0x68656c6c6f20776f726c64"
expected
.
Priority
=
100
expected
.
Ttl
=
100
expected
.
Topic
=
[]
string
{
"0x68656c6c6f20776f726c64"
}
expected
.
Topic
s
=
[]
string
{
"0x68656c6c6f20776f726c64"
}
args
:=
new
(
WhisperMessageArgs
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
...
...
@@ -343,7 +343,7 @@ func TestWhisperMessageArgs(t *testing.T) {
t
.
Errorf
(
"Priority shoud be %#v but is %#v"
,
expected
.
Priority
,
args
.
Priority
)
}
// if expected.Topic
!= args.Topic
{
// if expected.Topic
s != args.Topics
{
// t.Errorf("Topic shoud be %#v but is %#v", expected.Topic, args.Topic)
// }
}
...
...
rpc/responses.go
浏览文件 @
2da7af4b
...
...
@@ -2,6 +2,7 @@ package rpc
import
(
"encoding/json"
// "fmt"
"math/big"
"github.com/ethereum/go-ethereum/core/types"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录