les: fix panic (#20013)

This commit is contained in:
gary rong 2019-08-27 21:29:00 +08:00 committed by Martin Holst Swende
parent 68502595f6
commit 396f1dd87b

View File

@ -583,7 +583,6 @@ func (h *serverHandler) handleMsg(p *peer, wg *sync.WaitGroup) error {
} }
// Look up the root hash belonging to the request // Look up the root hash belonging to the request
var ( var (
number *uint64
header *types.Header header *types.Header
trie state.Trie trie state.Trie
) )
@ -591,7 +590,7 @@ func (h *serverHandler) handleMsg(p *peer, wg *sync.WaitGroup) error {
root, lastBHash = common.Hash{}, request.BHash root, lastBHash = common.Hash{}, request.BHash
if header = h.blockchain.GetHeaderByHash(request.BHash); header == nil { if header = h.blockchain.GetHeaderByHash(request.BHash); header == nil {
p.Log().Warn("Failed to retrieve header for proof", "block", *number, "hash", request.BHash) p.Log().Warn("Failed to retrieve header for proof", "hash", request.BHash)
atomic.AddUint32(&p.invalidCount, 1) atomic.AddUint32(&p.invalidCount, 1)
continue continue
} }