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
7ec8c257
Commit
7ec8c257
authored
Jun 16, 2015
by
SilentCicero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New DataArgs and eth_sendRawTransaction
parent
e952bb65
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
3 deletions
+64
-3
api.go
rpc/api.go
+1
-1
eth.go
rpc/api/eth.go
+1
-1
eth_args.go
rpc/api/eth_args.go
+29
-0
args.go
rpc/args.go
+29
-0
xeth.go
xeth/xeth.go
+4
-1
No files found.
rpc/api.go
View file @
7ec8c257
...
@@ -171,7 +171,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
...
@@ -171,7 +171,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
*
reply
=
v
*
reply
=
v
case
"eth_sendRawTransaction"
:
case
"eth_sendRawTransaction"
:
args
:=
new
(
New
Sig
Args
)
args
:=
new
(
New
Data
Args
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
return
err
}
}
...
...
rpc/api/eth.go
View file @
7ec8c257
...
@@ -250,7 +250,7 @@ func (self *ethApi) Sign(req *shared.Request) (interface{}, error) {
...
@@ -250,7 +250,7 @@ func (self *ethApi) Sign(req *shared.Request) (interface{}, error) {
func
(
self
*
ethApi
)
PushTx
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
func
(
self
*
ethApi
)
PushTx
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
args
:=
new
(
New
Sig
Args
)
args
:=
new
(
New
Data
Args
)
if
err
:=
self
.
codec
.
Decode
(
req
.
Params
,
&
args
);
err
!=
nil
{
if
err
:=
self
.
codec
.
Decode
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
nil
,
shared
.
NewDecodeParamError
(
err
.
Error
())
return
nil
,
shared
.
NewDecodeParamError
(
err
.
Error
())
}
}
...
...
rpc/api/eth_args.go
View file @
7ec8c257
...
@@ -226,6 +226,35 @@ func (args *GetDataArgs) UnmarshalJSON(b []byte) (err error) {
...
@@ -226,6 +226,35 @@ func (args *GetDataArgs) UnmarshalJSON(b []byte) (err error) {
return
nil
return
nil
}
}
type
NewDataArgs
struct
{
Data
string
}
func
(
args
*
NewDataArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
interface
{}
if
err
:=
json
.
Unmarshal
(
b
,
&
obj
);
err
!=
nil
{
return
shared
.
NewDecodeParamError
(
err
.
Error
())
}
// Check for sufficient params
if
len
(
obj
)
<
1
{
return
shared
.
NewInsufficientParamsError
(
len
(
obj
),
1
)
}
data
,
ok
:=
obj
[
0
]
.
(
string
)
if
!
ok
{
return
shared
.
NewInvalidTypeError
(
"data"
,
"not a string"
)
}
args
.
Data
=
data
if
len
(
args
.
Data
)
==
0
{
return
shared
.
NewValidationError
(
"data"
,
"is required"
)
}
return
nil
}
type
NewSigArgs
struct
{
type
NewSigArgs
struct
{
From
string
From
string
Data
string
Data
string
...
...
rpc/args.go
View file @
7ec8c257
...
@@ -154,6 +154,35 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) {
...
@@ -154,6 +154,35 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) {
return
nil
return
nil
}
}
type
NewDataArgs
struct
{
Data
string
}
func
(
args
*
NewDataArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
interface
{}
if
err
:=
json
.
Unmarshal
(
b
,
&
obj
);
err
!=
nil
{
return
NewDecodeParamError
(
err
.
Error
())
}
// Check for sufficient params
if
len
(
obj
)
<
1
{
return
NewInsufficientParamsError
(
len
(
obj
),
1
)
}
data
,
ok
:=
obj
[
0
]
.
(
string
)
if
!
ok
{
return
NewInvalidTypeError
(
"data"
,
"not a string"
)
}
args
.
Data
=
data
if
len
(
args
.
Data
)
==
0
{
return
NewValidationError
(
"data"
,
"is required"
)
}
return
nil
}
type
NewTxArgs
struct
{
type
NewTxArgs
struct
{
From
string
From
string
To
string
To
string
...
...
xeth/xeth.go
View file @
7ec8c257
...
@@ -787,6 +787,9 @@ func (self *XEth) FromNumber(str string) string {
...
@@ -787,6 +787,9 @@ func (self *XEth) FromNumber(str string) string {
func
(
self
*
XEth
)
PushTx
(
encodedTx
string
)
(
string
,
error
)
{
func
(
self
*
XEth
)
PushTx
(
encodedTx
string
)
(
string
,
error
)
{
tx
:=
types
.
NewTransactionFromBytes
(
common
.
FromHex
(
encodedTx
))
tx
:=
types
.
NewTransactionFromBytes
(
common
.
FromHex
(
encodedTx
))
glog
.
V
(
logger
.
Info
)
.
Infof
(
"Tx(%x) gas: %x
\n
"
,
tx
.
Hash
(),
tx
.
Gas
())
err
:=
self
.
backend
.
TxPool
()
.
Add
(
tx
)
err
:=
self
.
backend
.
TxPool
()
.
Add
(
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
...
@@ -965,7 +968,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
...
@@ -965,7 +968,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
return
core
.
AddressFromMessage
(
tx
)
.
Hex
(),
nil
return
core
.
AddressFromMessage
(
tx
)
.
Hex
(),
nil
}
else
{
}
else
{
glog
.
V
(
logger
.
Info
)
.
Infof
(
"
Tx(%x) to: %x
\n
"
,
tx
.
Hash
(),
tx
.
To
())
glog
.
V
(
logger
.
Info
)
.
Infof
(
"
YEYEYE!! Tx(%x) to: %x
\n
, gas: %x"
,
tx
.
Hash
(),
tx
.
To
(),
tx
.
Gas
())
}
}
return
tx
.
Hash
()
.
Hex
(),
nil
return
tx
.
Hash
()
.
Hex
(),
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