From cfe566f0e1123b0f6da9b1d10b91d1291a8fe5c5 Mon Sep 17 00:00:00 2001 From: ucwong Date: Mon, 1 Jul 2019 22:44:41 +0800 Subject: [PATCH] Fix txpool nil point exception when add is nil --- core/tx_pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index 5d37fcffc0..44e0db8d36 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -1057,7 +1057,7 @@ 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()) ) - if rem == nil { + if rem == nil || add == nil { // This can happen if a setHead is performed, where we simply discard the old // head from the chain. // If that is the case, we don't have the lost transactions any more, and