Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
7ffabf1d
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,发现更多精彩内容 >>
提交
7ffabf1d
编写于
6月 29, 2015
作者:
B
Bas van Kervel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add json parsing method for resend transaction
上级
6fdddc5a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
76 addition
and
2 deletion
+76
-2
rpc/api/eth.go
rpc/api/eth.go
+0
-1
rpc/api/eth_args.go
rpc/api/eth_args.go
+76
-1
未找到文件。
rpc/api/eth.go
浏览文件 @
7ffabf1d
...
@@ -12,7 +12,6 @@ import (
...
@@ -12,7 +12,6 @@ import (
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
"gopkg.in/fatih/set.v0"
"gopkg.in/fatih/set.v0"
"fmt"
)
)
const
(
const
(
...
...
rpc/api/eth_args.go
浏览文件 @
7ffabf1d
...
@@ -4,8 +4,8 @@ import (
...
@@ -4,8 +4,8 @@ import (
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"math/big"
"math/big"
"strconv"
"strconv"
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
...
@@ -899,6 +899,81 @@ type ResendArgs struct {
...
@@ -899,6 +899,81 @@ type ResendArgs struct {
GasLimit
string
GasLimit
string
}
}
func
(
tx
*
tx
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
fields
map
[
string
]
interface
{}
if
err
:=
json
.
Unmarshal
(
b
,
&
fields
);
err
!=
nil
{
return
shared
.
NewDecodeParamError
(
err
.
Error
())
}
trans
:=
new
(
types
.
Transaction
)
if
val
,
found
:=
fields
[
"To"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
&&
len
(
strVal
)
>
0
{
tx
.
To
=
strVal
to
:=
common
.
StringToAddress
(
strVal
)
trans
.
Recipient
=
&
to
}
}
if
val
,
found
:=
fields
[
"From"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
From
=
strVal
}
}
if
val
,
found
:=
fields
[
"Nonce"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
Nonce
=
strVal
if
trans
.
AccountNonce
,
err
=
strconv
.
ParseUint
(
strVal
,
10
,
64
);
err
!=
nil
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.Nonce - %v"
,
err
))
}
}
}
var
parseOk
bool
if
val
,
found
:=
fields
[
"Value"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
Value
=
strVal
if
trans
.
Amount
,
parseOk
=
new
(
big
.
Int
)
.
SetString
(
strVal
,
0
);
!
parseOk
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.Amount - %v"
,
err
))
}
}
}
if
val
,
found
:=
fields
[
"Data"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
Data
=
strVal
if
strings
.
HasPrefix
(
strVal
,
"0x"
)
{
trans
.
Payload
=
common
.
Hex2Bytes
(
strVal
[
2
:
])
}
else
{
trans
.
Payload
=
common
.
Hex2Bytes
(
strVal
)
}
}
}
if
val
,
found
:=
fields
[
"GasLimit"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
GasLimit
=
strVal
if
trans
.
GasLimit
,
parseOk
=
new
(
big
.
Int
)
.
SetString
(
strVal
,
0
);
!
parseOk
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.GasLimit - %v"
,
err
))
}
}
}
if
val
,
found
:=
fields
[
"GasPrice"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
GasPrice
=
strVal
if
trans
.
Price
,
parseOk
=
new
(
big
.
Int
)
.
SetString
(
strVal
,
0
);
!
parseOk
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.GasPrice - %v"
,
err
))
}
}
}
tx
.
tx
=
trans
return
nil
}
func
(
args
*
ResendArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
func
(
args
*
ResendArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
interface
{}
var
obj
[]
interface
{}
if
err
=
json
.
Unmarshal
(
b
,
&
obj
);
err
!=
nil
{
if
err
=
json
.
Unmarshal
(
b
,
&
obj
);
err
!=
nil
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录