From 59f60cda2ba62533ef29a44dc1fc698764157fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felf=C3=B6ldi=20Zsolt?= Date: Tue, 9 Jan 2018 11:41:59 +0100 Subject: [PATCH] les: fix les/1 CHT compatibility issue (#15692) --- les/handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/les/handler.go b/les/handler.go index e310942ba0ae7..d627c3e1845ef 100644 --- a/les/handler.go +++ b/les/handler.go @@ -846,8 +846,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { } if header := pm.blockchain.GetHeaderByNumber(req.BlockNum); header != nil { - sectionHead := core.GetCanonicalHash(pm.chainDb, (req.ChtNum+1)*light.ChtV1Frequency-1) - if root := light.GetChtRoot(pm.chainDb, req.ChtNum, sectionHead); root != (common.Hash{}) { + sectionHead := core.GetCanonicalHash(pm.chainDb, req.ChtNum*light.ChtV1Frequency-1) + if root := light.GetChtRoot(pm.chainDb, req.ChtNum-1, sectionHead); root != (common.Hash{}) { if tr, _ := trie.New(root, trieDb); tr != nil { var encNumber [8]byte binary.BigEndian.PutUint64(encNumber[:], req.BlockNum)