From c6350bb0c76955633195b11d560007017b18785f Mon Sep 17 00:00:00 2001 From: chao Date: Wed, 27 Mar 2019 20:01:00 -0700 Subject: [PATCH] fix nil pointer error for calculate reponse in state sync --- node/node_syncing.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node/node_syncing.go b/node/node_syncing.go index ad4f69eee..c9c479216 100644 --- a/node/node_syncing.go +++ b/node/node_syncing.go @@ -183,6 +183,9 @@ func (node *Node) CalculateResponse(request *downloader_pb.DownloaderRequest) (* var hash common.Hash hash.SetBytes(bytes) block := node.blockchain.GetBlockByHash(hash) + if block == nil { + continue + } encodedBlock, err := rlp.EncodeToBytes(block) if err == nil { response.Payload = append(response.Payload, encodedBlock)