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
9cc0f606
Commit
9cc0f606
authored
Dec 14, 2016
by
Péter Szilágyi
Committed by
GitHub
Dec 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3429 from bas-vk/txpool-crash
core: init pending state in tx pool on creation
parents
fdb8edf5
9f1520b4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
tx_pool.go
core/tx_pool.go
+4
-10
No files found.
core/tx_pool.go
View file @
9cc0f606
...
@@ -124,6 +124,8 @@ func NewTxPool(config *params.ChainConfig, eventMux *event.TypeMux, currentState
...
@@ -124,6 +124,8 @@ func NewTxPool(config *params.ChainConfig, eventMux *event.TypeMux, currentState
quit
:
make
(
chan
struct
{}),
quit
:
make
(
chan
struct
{}),
}
}
pool
.
resetState
()
pool
.
wg
.
Add
(
2
)
pool
.
wg
.
Add
(
2
)
go
pool
.
eventLoop
()
go
pool
.
eventLoop
()
go
pool
.
expirationLoop
()
go
pool
.
expirationLoop
()
...
@@ -196,12 +198,8 @@ func (pool *TxPool) Stop() {
...
@@ -196,12 +198,8 @@ func (pool *TxPool) Stop() {
}
}
func
(
pool
*
TxPool
)
State
()
*
state
.
ManagedState
{
func
(
pool
*
TxPool
)
State
()
*
state
.
ManagedState
{
pool
.
mu
.
Lock
()
pool
.
mu
.
RLock
()
defer
pool
.
mu
.
Unlock
()
defer
pool
.
mu
.
RUnlock
()
if
pool
.
pendingState
==
nil
{
pool
.
resetState
()
}
return
pool
.
pendingState
return
pool
.
pendingState
}
}
...
@@ -381,10 +379,6 @@ func (pool *TxPool) enqueueTx(hash common.Hash, tx *types.Transaction) {
...
@@ -381,10 +379,6 @@ func (pool *TxPool) enqueueTx(hash common.Hash, tx *types.Transaction) {
//
//
// Note, this method assumes the pool lock is held!
// Note, this method assumes the pool lock is held!
func
(
pool
*
TxPool
)
promoteTx
(
addr
common
.
Address
,
hash
common
.
Hash
,
tx
*
types
.
Transaction
)
{
func
(
pool
*
TxPool
)
promoteTx
(
addr
common
.
Address
,
hash
common
.
Hash
,
tx
*
types
.
Transaction
)
{
// Init delayed since tx pool could have been started before any state sync
if
pool
.
pendingState
==
nil
{
pool
.
resetState
()
}
// Try to insert the transaction into the pending queue
// Try to insert the transaction into the pending queue
if
pool
.
pending
[
addr
]
==
nil
{
if
pool
.
pending
[
addr
]
==
nil
{
pool
.
pending
[
addr
]
=
newTxList
(
true
)
pool
.
pending
[
addr
]
=
newTxList
(
true
)
...
...
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