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
ec866b06
Commit
ec866b06
authored
Jun 24, 2015
by
Bas van Kervel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added eth.resend
parent
056e9dd3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
0 deletions
+76
-0
eth.go
rpc/api/eth.go
+18
-0
eth_args.go
rpc/api/eth_args.go
+50
-0
eth_js.go
rpc/api/eth_js.go
+7
-0
utils.go
rpc/api/utils.go
+1
-0
No files found.
rpc/api/eth.go
View file @
ec866b06
...
...
@@ -6,6 +6,7 @@ import (
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/shared"
...
...
@@ -74,6 +75,7 @@ var (
"eth_hashrate"
:
(
*
ethApi
)
.
Hashrate
,
"eth_getWork"
:
(
*
ethApi
)
.
GetWork
,
"eth_submitWork"
:
(
*
ethApi
)
.
SubmitWork
,
"eth_resend"
:
(
*
ethApi
)
.
Resend
,
"eth_pendingTransactions"
:
(
*
ethApi
)
.
PendingTransactions
,
}
)
...
...
@@ -553,6 +555,22 @@ 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
(
self
*
ethApi
)
Resend
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
args
:=
new
(
ResendArgs
)
if
err
:=
self
.
codec
.
Decode
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
nil
,
shared
.
NewDecodeParamError
(
err
.
Error
())
}
ret
,
err
:=
self
.
xeth
.
Transact
(
args
.
Tx
.
From
,
args
.
Tx
.
To
,
args
.
Tx
.
Nonce
,
args
.
Tx
.
Value
,
args
.
GasLimit
,
args
.
GasPrice
,
args
.
Tx
.
Data
)
if
err
!=
nil
{
return
nil
,
err
}
self
.
ethereum
.
TxPool
()
.
RemoveTransactions
(
types
.
Transactions
{
args
.
Tx
.
tx
})
return
ret
,
nil
}
func
(
self
*
ethApi
)
PendingTransactions
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
txs
:=
self
.
ethereum
.
TxPool
()
.
GetTransactions
()
...
...
rpc/api/eth_args.go
View file @
ec866b06
...
...
@@ -892,3 +892,53 @@ func newTx(t *types.Transaction) *tx {
GasPrice
:
t
.
GasPrice
()
.
String
(),
}
}
type
ResendArgs
struct
{
Tx
*
tx
GasPrice
string
GasLimit
string
}
func
(
args
*
ResendArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
interface
{}
if
err
=
json
.
Unmarshal
(
b
,
&
obj
);
err
!=
nil
{
return
shared
.
NewDecodeParamError
(
err
.
Error
())
}
if
len
(
obj
)
<
1
{
return
shared
.
NewInsufficientParamsError
(
len
(
obj
),
1
)
}
data
,
err
:=
json
.
Marshal
(
obj
[
0
])
if
err
!=
nil
{
return
shared
.
NewDecodeParamError
(
"Unable to parse transaction object"
)
}
trans
:=
new
(
tx
)
err
=
json
.
Unmarshal
(
data
,
trans
)
if
err
!=
nil
{
return
shared
.
NewDecodeParamError
(
"Unable to parse transaction object."
)
}
gasLimit
,
gasPrice
:=
trans
.
GasLimit
,
trans
.
GasPrice
if
len
(
obj
)
>
1
&&
obj
[
1
]
!=
nil
{
if
gp
,
ok
:=
obj
[
1
]
.
(
string
);
ok
{
gasPrice
=
gp
}
else
{
return
shared
.
NewInvalidTypeError
(
"gasPrice"
,
"not a string"
)
}
}
if
len
(
obj
)
>
2
&&
obj
[
2
]
!=
nil
{
if
gl
,
ok
:=
obj
[
2
]
.
(
string
);
ok
{
gasLimit
=
gl
}
else
{
return
shared
.
NewInvalidTypeError
(
"gasLimit"
,
"not a string"
)
}
}
args
.
Tx
=
trans
args
.
GasPrice
=
gasPrice
args
.
GasLimit
=
gasLimit
return
nil
}
rpc/api/eth_js.go
View file @
ec866b06
...
...
@@ -14,6 +14,13 @@ web3._extend({
params: 2,
inputFormatter: [web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputString],
outputFormatter: web3._extend.formatters.formatOutputString
}),
new web3._extend.Method({
name: 'resend',
call: 'eth_resend',
params: 3,
inputFormatter: [function(obj) { return obj; },web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputString],
outputFormatter: web3._extend.formatters.formatOutputString
})
],
properties:
...
...
rpc/api/utils.go
View file @
ec866b06
...
...
@@ -85,6 +85,7 @@ var (
"getWork"
,
"submitWork"
,
"pendingTransactions"
,
"resend"
,
},
"miner"
:
[]
string
{
"hashrate"
,
...
...
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