mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
[#19212] handle cases where add or rem could be nil
This commit is contained in:
parent
6638e4625b
commit
472a66bb12
1 changed files with 12 additions and 0 deletions
|
|
@ -392,6 +392,18 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
|
|||
rem = pool.chain.GetBlock(oldHead.Hash(), oldHead.Number.Uint64())
|
||||
add = pool.chain.GetBlock(newHead.Hash(), newHead.Number.Uint64())
|
||||
)
|
||||
|
||||
// handle cases where rem or add could come up nil
|
||||
if rem == nil && add == nil {
|
||||
return
|
||||
} else if rem != nil && add == nil {
|
||||
discarded = append(discarded, rem.Transactions()...)
|
||||
return
|
||||
} else if rem == nil && add != nil {
|
||||
included = append(included, add.Transactions()...)
|
||||
return
|
||||
}
|
||||
|
||||
for rem.NumberU64() > add.NumberU64() {
|
||||
discarded = append(discarded, rem.Transactions()...)
|
||||
if rem = pool.chain.GetBlock(rem.ParentHash(), rem.NumberU64()-1); rem == nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue