mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +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
|
// Try to inject a busy marker and start a reset if successful
|
||||||
select {
|
select {
|
||||||
case resetBusy <- struct{}{}:
|
case resetBusy <- struct{}{}:
|
||||||
statedb, err := p.chain.StateAt(newHead.Root)
|
// Updates the statedb with the new chain head. The head state may be
|
||||||
if err != nil {
|
// unavailable if the initial state sync has not yet completed.
|
||||||
log.Crit("Failed to reset txpool state", "err", err)
|
if statedb, err := p.chain.StateAt(newHead.Root); err != nil {
|
||||||
}
|
log.Error("Failed to reset txpool state", "err", err)
|
||||||
|
} else {
|
||||||
p.stateLock.Lock()
|
p.stateLock.Lock()
|
||||||
p.state = statedb
|
p.state = statedb
|
||||||
p.stateLock.Unlock()
|
p.stateLock.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
// Busy marker injected, start a new subpool reset
|
// Busy marker injected, start a new subpool reset
|
||||||
go func(oldHead, newHead *types.Header) {
|
go func(oldHead, newHead *types.Header) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue