mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
les: only advertise and search for LES2 topic
This commit is contained in:
parent
9a61c871a4
commit
313384f474
3 changed files with 7 additions and 7 deletions
|
|
@ -221,9 +221,8 @@ func (s *LightEthereum) Start(srvr *p2p.Server) error {
|
||||||
s.startBloomHandlers()
|
s.startBloomHandlers()
|
||||||
log.Warn("Light client mode is an experimental feature")
|
log.Warn("Light client mode is an experimental feature")
|
||||||
s.netRPCService = ethapi.NewPublicNetAPI(srvr, s.networkId)
|
s.netRPCService = ethapi.NewPublicNetAPI(srvr, s.networkId)
|
||||||
// search the topic belonging to the oldest supported protocol because
|
// clients are searching for the first advertised protocol in the list
|
||||||
// servers always advertise all supported protocols
|
protocolVersion := AdvertiseProtocolVersions[0]
|
||||||
protocolVersion := ClientProtocolVersions[len(ClientProtocolVersions)-1]
|
|
||||||
s.serverPool.start(srvr, lesTopic(s.blockchain.Genesis().Hash(), protocolVersion))
|
s.serverPool.start(srvr, lesTopic(s.blockchain.Genesis().Hash(), protocolVersion))
|
||||||
s.protocolManager.Start()
|
s.protocolManager.Start()
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,9 @@ const (
|
||||||
|
|
||||||
// Supported versions of the les protocol (first is primary)
|
// Supported versions of the les protocol (first is primary)
|
||||||
var (
|
var (
|
||||||
ClientProtocolVersions = []uint{lpv2, lpv1}
|
ClientProtocolVersions = []uint{lpv2, lpv1}
|
||||||
ServerProtocolVersions = []uint{lpv2, lpv1}
|
ServerProtocolVersions = []uint{lpv2, lpv1}
|
||||||
|
AdvertiseProtocolVersions = []uint{lpv2} // clients are searching for the first advertised protocol in the list
|
||||||
)
|
)
|
||||||
|
|
||||||
// Number of implemented message corresponding to different protocol versions.
|
// Number of implemented message corresponding to different protocol versions.
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@ func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
lesTopics := make([]discv5.Topic, len(ServerProtocolVersions))
|
lesTopics := make([]discv5.Topic, len(AdvertiseProtocolVersions))
|
||||||
for i, pv := range ServerProtocolVersions {
|
for i, pv := range AdvertiseProtocolVersions {
|
||||||
lesTopics[i] = lesTopic(eth.BlockChain().Genesis().Hash(), pv)
|
lesTopics[i] = lesTopic(eth.BlockChain().Genesis().Hash(), pv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue