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
03bb88de
Commit
03bb88de
authored
May 05, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xeth, rpc: added nonce setting through RPC and xeth transact
parent
aa884c05
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
5 deletions
+27
-5
resolver.go
common/resolver/resolver.go
+2
-2
api.go
rpc/api.go
+7
-1
args.go
rpc/args.go
+10
-0
xeth.go
xeth/xeth.go
+8
-2
No files found.
common/resolver/resolver.go
View file @
03bb88de
...
...
@@ -24,11 +24,11 @@ var HashRegContractAddress string = "0000000000000000000000000000000000000000000
func
CreateContracts
(
xeth
*
xe
.
XEth
,
addr
string
)
{
var
err
error
URLHintContractAddress
,
err
=
xeth
.
Transact
(
addr
,
""
,
"100000000000"
,
"1000000"
,
"100000"
,
ContractCodeURLhint
)
URLHintContractAddress
,
err
=
xeth
.
Transact
(
addr
,
""
,
"
"
,
"
100000000000"
,
"1000000"
,
"100000"
,
ContractCodeURLhint
)
if
err
!=
nil
{
panic
(
err
)
}
HashRegContractAddress
,
err
=
xeth
.
Transact
(
addr
,
""
,
"100000000000"
,
"1000000"
,
"100000"
,
ContractCodeHashReg
)
HashRegContractAddress
,
err
=
xeth
.
Transact
(
addr
,
""
,
"
"
,
"
100000000000"
,
"1000000"
,
"100000"
,
ContractCodeHashReg
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
rpc/api.go
View file @
03bb88de
...
...
@@ -173,7 +173,13 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return
fmt
.
Errorf
(
"Transaction not confirmed"
)
}
v
,
err
:=
api
.
xeth
()
.
Transact
(
args
.
From
,
args
.
To
,
args
.
Value
.
String
(),
args
.
Gas
.
String
(),
args
.
GasPrice
.
String
(),
args
.
Data
)
// nonce may be nil ("guess" mode)
var
nonce
string
if
args
.
Nonce
!=
nil
{
nonce
=
args
.
Nonce
.
String
()
}
v
,
err
:=
api
.
xeth
()
.
Transact
(
args
.
From
,
args
.
To
,
nonce
,
args
.
Value
.
String
(),
args
.
Gas
.
String
(),
args
.
GasPrice
.
String
(),
args
.
Data
)
if
err
!=
nil
{
return
err
}
...
...
rpc/args.go
View file @
03bb88de
...
...
@@ -157,6 +157,7 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) {
type
NewTxArgs
struct
{
From
string
To
string
Nonce
*
big
.
Int
Value
*
big
.
Int
Gas
*
big
.
Int
GasPrice
*
big
.
Int
...
...
@@ -170,6 +171,7 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
var
ext
struct
{
From
string
To
string
Nonce
interface
{}
Value
interface
{}
Gas
interface
{}
GasPrice
interface
{}
...
...
@@ -200,6 +202,14 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
args
.
Data
=
ext
.
Data
var
num
*
big
.
Int
if
ext
.
Nonce
!=
nil
{
num
,
err
=
numString
(
ext
.
Nonce
)
if
err
!=
nil
{
return
err
}
}
args
.
Nonce
=
num
if
ext
.
Value
==
nil
{
num
=
big
.
NewInt
(
0
)
}
else
{
...
...
xeth/xeth.go
View file @
03bb88de
...
...
@@ -648,7 +648,7 @@ func (self *XEth) ConfirmTransaction(tx string) bool {
}
func
(
self
*
XEth
)
Transact
(
fromStr
,
toStr
,
valueStr
,
gasStr
,
gasPriceStr
,
codeStr
string
)
(
string
,
error
)
{
func
(
self
*
XEth
)
Transact
(
fromStr
,
toStr
,
nonceStr
,
valueStr
,
gasStr
,
gasPriceStr
,
codeStr
string
)
(
string
,
error
)
{
var
(
from
=
common
.
HexToAddress
(
fromStr
)
to
=
common
.
HexToAddress
(
toStr
)
...
...
@@ -704,7 +704,13 @@ func (self *XEth) Transact(fromStr, toStr, valueStr, gasStr, gasPriceStr, codeSt
}
state
:=
self
.
backend
.
ChainManager
()
.
TxState
()
nonce
:=
state
.
NewNonce
(
from
)
var
nonce
uint64
if
len
(
nonceStr
)
!=
0
{
nonce
=
common
.
Big
(
nonceStr
)
.
Uint64
()
}
else
{
nonce
=
state
.
NewNonce
(
from
)
}
tx
.
SetNonce
(
nonce
)
if
err
:=
self
.
sign
(
tx
,
from
,
false
);
err
!=
nil
{
...
...
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