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
c55e1b49
Unverified
Commit
c55e1b49
authored
Aug 08, 2019
by
Martin Holst Swende
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ethapi: implement filltransaction
parent
aa6005b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
api.go
internal/ethapi/api.go
+16
-0
web3ext.go
internal/web3ext/web3ext.go
+6
-0
No files found.
internal/ethapi/api.go
View file @
c55e1b49
...
...
@@ -1441,6 +1441,22 @@ func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args Sen
return
SubmitTransaction
(
ctx
,
s
.
b
,
signed
)
}
// FillTransaction fills the defaults (nonce, gas, gasPrice) on a given unsigned transaction,
// and returns it to the caller for further processing (signing + broadcast)
func
(
s
*
PublicTransactionPoolAPI
)
FillTransaction
(
ctx
context
.
Context
,
args
SendTxArgs
)
(
*
SignTransactionResult
,
error
)
{
// Set some sanity defaults and terminate on failure
if
err
:=
args
.
setDefaults
(
ctx
,
s
.
b
);
err
!=
nil
{
return
nil
,
err
}
// Assemble the transaction and obtain rlp
tx
:=
args
.
toTransaction
()
data
,
err
:=
rlp
.
EncodeToBytes
(
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
SignTransactionResult
{
data
,
tx
},
nil
}
// SendRawTransaction will add the signed transaction to the transaction pool.
// The sender is responsible for signing the transaction and using the correct nonce.
func
(
s
*
PublicTransactionPoolAPI
)
SendRawTransaction
(
ctx
context
.
Context
,
encodedTx
hexutil
.
Bytes
)
(
common
.
Hash
,
error
)
{
...
...
internal/web3ext/web3ext.go
View file @
c55e1b49
...
...
@@ -483,6 +483,12 @@ web3._extend({
params: 1,
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
}),
new web3._extend.Method({
name: 'fillTransaction',
call: 'eth_fillTransaction',
params: 1,
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
}),
new web3._extend.Method({
name: 'getHeaderByNumber',
call: 'eth_getHeaderByNumber',
...
...
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