mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
core/txpool: fix panic in txpool reset
This commit is contained in:
parent
a874ea621f
commit
671ea27fec
1 changed files with 8 additions and 6 deletions
|
|
@ -245,13 +245,15 @@ func (p *TxPool) loop(head *types.Header) {
|
|||
// Try to inject a busy marker and start a reset if successful
|
||||
select {
|
||||
case resetBusy <- struct{}{}:
|
||||
statedb, err := p.chain.StateAt(newHead.Root)
|
||||
if err != nil {
|
||||
log.Crit("Failed to reset txpool state", "err", err)
|
||||
// Updates the statedb with the new chain head. The head state may be
|
||||
// unavailable if the initial state sync has not yet completed.
|
||||
if statedb, err := p.chain.StateAt(newHead.Root); err != nil {
|
||||
log.Error("Failed to reset txpool state", "err", err)
|
||||
} else {
|
||||
p.stateLock.Lock()
|
||||
p.state = statedb
|
||||
p.stateLock.Unlock()
|
||||
}
|
||||
p.stateLock.Lock()
|
||||
p.state = statedb
|
||||
p.stateLock.Unlock()
|
||||
|
||||
// Busy marker injected, start a new subpool reset
|
||||
go func(oldHead, newHead *types.Header) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue