From 0138f2f6ed9c95b05549865d5ae177dcf03756c4 Mon Sep 17 00:00:00 2001 From: pacamara Date: Thu, 14 Dec 2017 16:31:46 +0000 Subject: [PATCH] les: add GetCheckpoint-- fix TestOdrGetBlockLes2 fail --- les/sync.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/les/sync.go b/les/sync.go index 248c91dc97..521ba66570 100644 --- a/les/sync.go +++ b/les/sync.go @@ -95,6 +95,11 @@ func updateCheckpointFromPeer(pm *ProtocolManager, peer *peer, ctx context.Conte var peerHeadBlockNum = hbl.Number log.Debug("updateCheckpointFromPeer", "peerHeadBlockNum", peerHeadBlockNum) + if peerHeadBlockNum+1 < light.ChtFrequency { + log.Info("Peer has no fully processed blocks, nothing to do") + return + } + var sectionIdx uint64 = ((peerHeadBlockNum + 1) / light.ChtFrequency) - 1 log.Debug("Retrieving checkpoint with: ", "sectionIdx", sectionIdx)