aboutsummaryrefslogtreecommitdiffstats
path: root/les
diff options
context:
space:
mode:
authorFelföldi Zsolt <zsfelfoldi@gmail.com>2018-01-09 18:41:59 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-01-09 18:41:59 +0800
commit83d16574444d0b389755c9003e74a90d2ab7ca2e (patch)
treebdf066c42799014dd50bfa71d62c2dd85423b66a /les
parent9d06026c1991fdd8f034ce194fa20a0740c21810 (diff)
downloadgo-tangerine-83d16574444d0b389755c9003e74a90d2ab7ca2e.tar
go-tangerine-83d16574444d0b389755c9003e74a90d2ab7ca2e.tar.gz
go-tangerine-83d16574444d0b389755c9003e74a90d2ab7ca2e.tar.bz2
go-tangerine-83d16574444d0b389755c9003e74a90d2ab7ca2e.tar.lz
go-tangerine-83d16574444d0b389755c9003e74a90d2ab7ca2e.tar.xz
go-tangerine-83d16574444d0b389755c9003e74a90d2ab7ca2e.tar.zst
go-tangerine-83d16574444d0b389755c9003e74a90d2ab7ca2e.zip
les: fix les/1 CHT compatibility issue (#15692)
Diffstat (limited to 'les')
-rw-r--r--les/handler.go4
-rw-r--r--les/peer.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/les/handler.go b/les/handler.go
index e310942ba..d627c3e18 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)
diff --git a/les/peer.go b/les/peer.go
index 04d747a6b..b72c80d35 100644
--- a/les/peer.go
+++ b/les/peer.go
@@ -296,7 +296,7 @@ func (p *peer) RequestHelperTrieProofs(reqID, cost uint64, reqs []HelperTrieReq)
}
blockNum := binary.BigEndian.Uint64(req.Key)
// convert HelperTrie request to old CHT request
- reqsV1[i] = ChtReq{ChtNum: (req.TrieIdx+1)*(light.ChtFrequency/light.ChtV1Frequency) - 1, BlockNum: blockNum, FromLevel: req.FromLevel}
+ reqsV1[i] = ChtReq{ChtNum: (req.TrieIdx + 1) * (light.ChtFrequency / light.ChtV1Frequency), BlockNum: blockNum, FromLevel: req.FromLevel}
}
return sendRequest(p.rw, GetHeaderProofsMsg, reqID, cost, reqsV1)
case lpv2: