@@ -76,18 +76,30 @@ func (c *lesCommons) makeProtocols(versions []uint) []p2p.Protocol {
76
76
// nodeInfo retrieves some protocol metadata about the running host node.
77
77
func (c * lesCommons ) nodeInfo () interface {} {
78
78
var cht light.TrustedCheckpoint
79
- sections , _ , sectionHead := c .chtIndexer .Sections ()
80
- sections2 , _ , sectionHead2 := c .bloomTrieIndexer .Sections ()
79
+ sections , _ , _ := c .chtIndexer .Sections ()
80
+ sections2 , _ , _ := c .bloomTrieIndexer .Sections ()
81
+
82
+ if ! c .protocolManager .lightSync {
83
+ // convert to client section size if running in server mode
84
+ sections /= light .CHTFrequencyClient / light .CHTFrequencyServer
85
+ }
86
+
81
87
if sections2 < sections {
82
88
sections = sections2
83
- sectionHead = sectionHead2
84
89
}
85
90
if sections > 0 {
86
91
sectionIndex := sections - 1
92
+ sectionHead := c .bloomTrieIndexer .SectionHead (sectionIndex )
93
+ var chtRoot common.Hash
94
+ if c .protocolManager .lightSync {
95
+ chtRoot = light .GetChtRoot (c .chainDb , sectionIndex , sectionHead )
96
+ } else {
97
+ chtRoot = light .GetChtV2Root (c .chainDb , sectionIndex , sectionHead )
98
+ }
87
99
cht = light.TrustedCheckpoint {
88
100
SectionIdx : sectionIndex ,
89
101
SectionHead : sectionHead ,
90
- CHTRoot : light . GetChtRoot ( c . chainDb , sectionIndex , sectionHead ) ,
102
+ CHTRoot : chtRoot ,
91
103
BloomRoot : light .GetBloomTrieRoot (c .chainDb , sectionIndex , sectionHead ),
92
104
}
93
105
}
0 commit comments