fix nil pointer error for calculate reponse in state sync

pull/662/head
chao 6 years ago committed by Leo Chen
parent 3ba0daf706
commit c6350bb0c7
  1. 3
      node/node_syncing.go

@ -183,6 +183,9 @@ func (node *Node) CalculateResponse(request *downloader_pb.DownloaderRequest) (*
var hash common.Hash var hash common.Hash
hash.SetBytes(bytes) hash.SetBytes(bytes)
block := node.blockchain.GetBlockByHash(hash) block := node.blockchain.GetBlockByHash(hash)
if block == nil {
continue
}
encodedBlock, err := rlp.EncodeToBytes(block) encodedBlock, err := rlp.EncodeToBytes(block)
if err == nil { if err == nil {
response.Payload = append(response.Payload, encodedBlock) response.Payload = append(response.Payload, encodedBlock)

Loading…
Cancel
Save