Fix txpool nil point exception when add is nil

This commit is contained in:
ucwong 2019-07-01 22:44:41 +08:00
parent f7cdea2bdc
commit cfe566f0e1

View file

@ -1057,7 +1057,7 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
rem = pool.chain.GetBlock(oldHead.Hash(), oldHead.Number.Uint64()) rem = pool.chain.GetBlock(oldHead.Hash(), oldHead.Number.Uint64())
add = pool.chain.GetBlock(newHead.Hash(), newHead.Number.Uint64()) add = pool.chain.GetBlock(newHead.Hash(), newHead.Number.Uint64())
) )
if rem == nil { if rem == nil || add == nil {
// This can happen if a setHead is performed, where we simply discard the old // This can happen if a setHead is performed, where we simply discard the old
// head from the chain. // head from the chain.
// If that is the case, we don't have the lost transactions any more, and // If that is the case, we don't have the lost transactions any more, and