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
c3deafab
Commit
c3deafab
authored
Mar 04, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update NewTXArgs to accept hex
parent
c92e48ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
21 deletions
+28
-21
api.go
rpc/api.go
+9
-6
args.go
rpc/args.go
+19
-15
No files found.
rpc/api.go
View file @
c3deafab
...
...
@@ -252,12 +252,12 @@ func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error {
}
func
(
p
*
EthereumApi
)
Transact
(
args
*
NewTxArgs
,
reply
*
interface
{})
error
{
if
len
(
args
.
Gas
)
==
0
{
args
.
Gas
=
defaultGas
.
String
()
if
args
.
Gas
==
ethutil
.
Big
0
{
args
.
Gas
=
defaultGas
}
if
len
(
args
.
GasPrice
)
==
0
{
args
.
GasPrice
=
defaultGasPrice
.
String
()
if
args
.
GasPrice
==
ethutil
.
Big
0
{
args
.
GasPrice
=
defaultGasPrice
}
// TODO if no_private_key then
...
...
@@ -281,7 +281,10 @@ func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) error {
p.register[ags.From] = append(p.register[args.From], args)
}
*/
result
,
_
:=
p
.
xeth
()
.
Transact
(
/* TODO specify account */
args
.
To
,
args
.
Value
,
args
.
Gas
,
args
.
GasPrice
,
args
.
Data
)
result
,
err
:=
p
.
xeth
()
.
Transact
(
/* TODO specify account */
args
.
To
,
args
.
Value
.
String
(),
args
.
Gas
.
String
(),
args
.
GasPrice
.
String
(),
args
.
Data
)
if
err
!=
nil
{
return
err
}
*
reply
=
result
//}
...
...
@@ -289,7 +292,7 @@ func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) error {
}
func
(
p
*
EthereumApi
)
Call
(
args
*
NewTxArgs
,
reply
*
interface
{})
error
{
result
,
err
:=
p
.
xeth
()
.
Call
(
/* TODO specify account */
args
.
To
,
args
.
Value
,
args
.
Gas
,
args
.
GasPrice
,
args
.
Data
)
result
,
err
:=
p
.
xeth
()
.
Call
(
/* TODO specify account */
args
.
To
,
args
.
Value
.
String
(),
args
.
Gas
.
String
(),
args
.
GasPrice
.
String
()
,
args
.
Data
)
if
err
!=
nil
{
return
err
}
...
...
rpc/args.go
View file @
c3deafab
package
rpc
import
"encoding/json"
import
(
"encoding/json"
"math/big"
import
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/ethutil"
)
type
GetBlockArgs
struct
{
BlockNumber
int32
...
...
@@ -23,12 +27,12 @@ func (obj *GetBlockArgs) UnmarshalJSON(b []byte) (err error) {
}
type
NewTxArgs
struct
{
From
string
`json:"from"`
To
string
`json:"to"`
Value
string
`json:"value"`
Gas
string
`json:"gas"`
GasPrice
string
`json:"gasPrice"`
Data
string
`json:"data"`
From
string
`json:"from"`
To
string
`json:"to"`
Value
*
big
.
Int
`json:"value"`
Gas
*
big
.
Int
`json:"gas"`
GasPrice
*
big
.
Int
`json:"gasPrice"`
Data
string
`json:"data"`
}
func
(
obj
*
NewTxArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
...
...
@@ -40,18 +44,18 @@ func (obj *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
Gas
string
GasPrice
string
Data
string
Code
string
//
Code string
}
if
err
=
json
.
Unmarshal
(
b
,
&
ext
);
err
==
nil
{
if
len
(
ext
.
Data
)
==
0
{
ext
.
Data
=
ext
.
Code
}
//
if len(ext.Data) == 0 {
//
ext.Data = ext.Code
//
}
obj
.
From
=
ext
.
From
obj
.
To
=
ext
.
To
obj
.
Value
=
e
xt
.
Value
obj
.
Gas
=
e
xt
.
Gas
obj
.
GasPrice
=
e
xt
.
GasPrice
obj
.
Value
=
e
thutil
.
Big
(
ext
.
Value
)
obj
.
Gas
=
e
thutil
.
Big
(
ext
.
Gas
)
obj
.
GasPrice
=
e
thutil
.
Big
(
ext
.
GasPrice
)
obj
.
Data
=
ext
.
Data
return
...
...
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