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
a5d5387d
Commit
a5d5387d
authored
Jun 30, 2015
by
Bas van Kervel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rebase with develop
parent
57dff6f1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
15 deletions
+33
-15
eth.go
rpc/api/eth.go
+9
-0
eth_args.go
rpc/api/eth_args.go
+24
-15
No files found.
rpc/api/eth.go
View file @
a5d5387d
...
...
@@ -7,7 +7,9 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/xeth"
...
...
@@ -555,6 +557,13 @@ func (self *ethApi) SubmitWork(req *shared.Request) (interface{}, error) {
return
self
.
xeth
.
RemoteMining
()
.
SubmitWork
(
args
.
Nonce
,
common
.
HexToHash
(
args
.
Digest
),
common
.
HexToHash
(
args
.
Header
)),
nil
}
func
rlpHash
(
x
interface
{})
(
h
common
.
Hash
)
{
hw
:=
sha3
.
NewKeccak256
()
rlp
.
Encode
(
hw
,
x
)
hw
.
Sum
(
h
[
:
0
])
return
h
}
func
(
self
*
ethApi
)
Resend
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
args
:=
new
(
ResendArgs
)
if
err
:=
self
.
codec
.
Decode
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
...
rpc/api/eth_args.go
View file @
a5d5387d
...
...
@@ -885,10 +885,10 @@ func newTx(t *types.Transaction) *tx {
tx
:
t
,
To
:
to
,
From
:
from
.
Hex
(),
Value
:
t
.
Amount
.
String
(),
Value
:
t
.
Value
()
.
String
(),
Nonce
:
strconv
.
Itoa
(
int
(
t
.
Nonce
())),
Data
:
"0x"
+
common
.
Bytes2Hex
(
t
.
Data
()),
GasLimit
:
t
.
Gas
Limit
.
String
(),
GasLimit
:
t
.
Gas
()
.
String
(),
GasPrice
:
t
.
GasPrice
()
.
String
(),
}
}
...
...
@@ -905,16 +905,21 @@ func (tx *tx) UnmarshalJSON(b []byte) (err error) {
return
shared
.
NewDecodeParamError
(
err
.
Error
())
}
trans
:=
new
(
types
.
Transaction
)
trans
.
Amount
=
new
(
big
.
Int
)
trans
.
GasLimit
=
new
(
big
.
Int
)
trans
.
Price
=
new
(
big
.
Int
)
var
(
nonce
uint64
to
common
.
Address
amount
=
new
(
big
.
Int
)
.
Set
(
common
.
Big0
)
gasLimit
=
new
(
big
.
Int
)
.
Set
(
common
.
Big0
)
gasPrice
=
new
(
big
.
Int
)
.
Set
(
common
.
Big0
)
data
[]
byte
contractCreation
=
true
)
if
val
,
found
:=
fields
[
"To"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
&&
len
(
strVal
)
>
0
{
tx
.
To
=
strVal
to
:=
common
.
String
ToAddress
(
strVal
)
trans
.
Recipient
=
&
to
to
=
common
.
Hex
ToAddress
(
strVal
)
contractCreation
=
false
}
}
...
...
@@ -927,7 +932,7 @@ func (tx *tx) UnmarshalJSON(b []byte) (err error) {
if
val
,
found
:=
fields
[
"Nonce"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
Nonce
=
strVal
if
trans
.
AccountN
once
,
err
=
strconv
.
ParseUint
(
strVal
,
10
,
64
);
err
!=
nil
{
if
n
once
,
err
=
strconv
.
ParseUint
(
strVal
,
10
,
64
);
err
!=
nil
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.Nonce - %v"
,
err
))
}
}
...
...
@@ -939,7 +944,7 @@ func (tx *tx) UnmarshalJSON(b []byte) (err error) {
if
val
,
found
:=
fields
[
"Value"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
Value
=
strVal
if
_
,
parseOk
=
trans
.
A
mount
.
SetString
(
strVal
,
0
);
!
parseOk
{
if
_
,
parseOk
=
a
mount
.
SetString
(
strVal
,
0
);
!
parseOk
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.Amount - %v"
,
err
))
}
}
...
...
@@ -949,9 +954,9 @@ func (tx *tx) UnmarshalJSON(b []byte) (err error) {
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
Data
=
strVal
if
strings
.
HasPrefix
(
strVal
,
"0x"
)
{
trans
.
Payload
=
common
.
Hex2Bytes
(
strVal
[
2
:
])
data
=
common
.
Hex2Bytes
(
strVal
[
2
:
])
}
else
{
trans
.
Payload
=
common
.
Hex2Bytes
(
strVal
)
data
=
common
.
Hex2Bytes
(
strVal
)
}
}
}
...
...
@@ -959,7 +964,7 @@ func (tx *tx) UnmarshalJSON(b []byte) (err error) {
if
val
,
found
:=
fields
[
"GasLimit"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
GasLimit
=
strVal
if
_
,
parseOk
=
trans
.
G
asLimit
.
SetString
(
strVal
,
0
);
!
parseOk
{
if
_
,
parseOk
=
g
asLimit
.
SetString
(
strVal
,
0
);
!
parseOk
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.GasLimit - %v"
,
err
))
}
}
...
...
@@ -968,13 +973,17 @@ func (tx *tx) UnmarshalJSON(b []byte) (err error) {
if
val
,
found
:=
fields
[
"GasPrice"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
GasPrice
=
strVal
if
_
,
parseOk
=
trans
.
Price
.
SetString
(
strVal
,
0
);
!
parseOk
{
if
_
,
parseOk
=
gas
Price
.
SetString
(
strVal
,
0
);
!
parseOk
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.GasPrice - %v"
,
err
))
}
}
}
tx
.
tx
=
trans
if
contractCreation
{
tx
.
tx
=
types
.
NewContractCreation
(
nonce
,
amount
,
gasLimit
,
gasPrice
,
data
)
}
else
{
tx
.
tx
=
types
.
NewTransaction
(
nonce
,
to
,
amount
,
gasLimit
,
gasPrice
,
data
)
}
return
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