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
fbe7caf1
Unverified
Commit
fbe7caf1
authored
Mar 06, 2019
by
贺鹏飞
Committed by
Péter Szilágyi
Mar 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: cache tx signature before obtaining lock
parent
5b0d3fa3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
tx_pool.go
core/tx_pool.go
+7
-0
No files found.
core/tx_pool.go
View file @
fbe7caf1
...
@@ -833,6 +833,9 @@ func (pool *TxPool) AddRemotes(txs []*types.Transaction) []error {
...
@@ -833,6 +833,9 @@ func (pool *TxPool) AddRemotes(txs []*types.Transaction) []error {
// addTx enqueues a single transaction into the pool if it is valid.
// addTx enqueues a single transaction into the pool if it is valid.
func
(
pool
*
TxPool
)
addTx
(
tx
*
types
.
Transaction
,
local
bool
)
error
{
func
(
pool
*
TxPool
)
addTx
(
tx
*
types
.
Transaction
,
local
bool
)
error
{
// Cache sender in transaction before obtaining lock (pool.signer is immutable)
types
.
Sender
(
pool
.
signer
,
tx
)
pool
.
mu
.
Lock
()
pool
.
mu
.
Lock
()
defer
pool
.
mu
.
Unlock
()
defer
pool
.
mu
.
Unlock
()
...
@@ -851,6 +854,10 @@ func (pool *TxPool) addTx(tx *types.Transaction, local bool) error {
...
@@ -851,6 +854,10 @@ func (pool *TxPool) addTx(tx *types.Transaction, local bool) error {
// addTxs attempts to queue a batch of transactions if they are valid.
// addTxs attempts to queue a batch of transactions if they are valid.
func
(
pool
*
TxPool
)
addTxs
(
txs
[]
*
types
.
Transaction
,
local
bool
)
[]
error
{
func
(
pool
*
TxPool
)
addTxs
(
txs
[]
*
types
.
Transaction
,
local
bool
)
[]
error
{
// Cache senders in transactions before obtaining lock (pool.signer is immutable)
for
_
,
tx
:=
range
txs
{
types
.
Sender
(
pool
.
signer
,
tx
)
}
pool
.
mu
.
Lock
()
pool
.
mu
.
Lock
()
defer
pool
.
mu
.
Unlock
()
defer
pool
.
mu
.
Unlock
()
...
...
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