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
2b4a5f26
Commit
2b4a5f26
authored
Sep 25, 2017
by
slumber1122
Committed by
Felix Lange
Sep 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal/ethapi: remove code duplication around tx sending (#15158)
parent
d6a61803
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
21 deletions
+7
-21
api.go
internal/ethapi/api.go
+7
-21
No files found.
internal/ethapi/api.go
View file @
2b4a5f26
...
@@ -1081,7 +1081,10 @@ func submitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c
...
@@ -1081,7 +1081,10 @@ func submitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c
}
}
if
tx
.
To
()
==
nil
{
if
tx
.
To
()
==
nil
{
signer
:=
types
.
MakeSigner
(
b
.
ChainConfig
(),
b
.
CurrentBlock
()
.
Number
())
signer
:=
types
.
MakeSigner
(
b
.
ChainConfig
(),
b
.
CurrentBlock
()
.
Number
())
from
,
_
:=
types
.
Sender
(
signer
,
tx
)
from
,
err
:=
types
.
Sender
(
signer
,
tx
)
if
err
!=
nil
{
return
common
.
Hash
{},
err
}
addr
:=
crypto
.
CreateAddress
(
from
,
tx
.
Nonce
())
addr
:=
crypto
.
CreateAddress
(
from
,
tx
.
Nonce
())
log
.
Info
(
"Submitted contract creation"
,
"fullhash"
,
tx
.
Hash
()
.
Hex
(),
"contract"
,
addr
.
Hex
())
log
.
Info
(
"Submitted contract creation"
,
"fullhash"
,
tx
.
Hash
()
.
Hex
(),
"contract"
,
addr
.
Hex
())
}
else
{
}
else
{
...
@@ -1129,29 +1132,12 @@ func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args Sen
...
@@ -1129,29 +1132,12 @@ func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args Sen
// SendRawTransaction will add the signed transaction to the transaction pool.
// SendRawTransaction will add the signed transaction to the transaction pool.
// The sender is responsible for signing the transaction and using the correct nonce.
// The sender is responsible for signing the transaction and using the correct nonce.
func
(
s
*
PublicTransactionPoolAPI
)
SendRawTransaction
(
ctx
context
.
Context
,
encodedTx
hexutil
.
Bytes
)
(
string
,
error
)
{
func
(
s
*
PublicTransactionPoolAPI
)
SendRawTransaction
(
ctx
context
.
Context
,
encodedTx
hexutil
.
Bytes
)
(
common
.
Hash
,
error
)
{
tx
:=
new
(
types
.
Transaction
)
tx
:=
new
(
types
.
Transaction
)
if
err
:=
rlp
.
DecodeBytes
(
encodedTx
,
tx
);
err
!=
nil
{
if
err
:=
rlp
.
DecodeBytes
(
encodedTx
,
tx
);
err
!=
nil
{
return
""
,
err
return
common
.
Hash
{},
err
}
if
err
:=
s
.
b
.
SendTx
(
ctx
,
tx
);
err
!=
nil
{
return
""
,
err
}
signer
:=
types
.
MakeSigner
(
s
.
b
.
ChainConfig
(),
s
.
b
.
CurrentBlock
()
.
Number
())
if
tx
.
To
()
==
nil
{
from
,
err
:=
types
.
Sender
(
signer
,
tx
)
if
err
!=
nil
{
return
""
,
err
}
addr
:=
crypto
.
CreateAddress
(
from
,
tx
.
Nonce
())
log
.
Info
(
"Submitted contract creation"
,
"fullhash"
,
tx
.
Hash
()
.
Hex
(),
"contract"
,
addr
.
Hex
())
}
else
{
log
.
Info
(
"Submitted transaction"
,
"fullhash"
,
tx
.
Hash
()
.
Hex
(),
"recipient"
,
tx
.
To
())
}
}
return
submitTransaction
(
ctx
,
s
.
b
,
tx
)
return
tx
.
Hash
()
.
Hex
(),
nil
}
}
// Sign calculates an ECDSA signature for:
// Sign calculates an ECDSA signature for:
...
...
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