Added removeStreamHandler again (#6996)

This commit is contained in:
Giulio rebuffo 2023-03-02 15:22:03 +01:00 committed by GitHub
parent c4ba26107e
commit d6ba1b65c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 21 deletions

View File

@ -94,7 +94,6 @@ func (l *LightClient) Start() {
defer tx.Rollback()
logPeers := time.NewTicker(time.Minute)
updateStatusSentinel := time.NewTicker(2 * time.Minute)
go l.chainTip.StartLoop()
for {
start := time.Now()
@ -219,14 +218,6 @@ func (l *LightClient) Start() {
continue
}
log.Info("[LightClient] P2P", "peers", peers)
case <-updateStatusSentinel.C:
if err := l.updateStatus(); err != nil {
if errors.Is(err, context.Canceled) {
return
}
log.Error("Could not update sentinel status", "err", err)
return
}
case <-l.ctx.Done():
return
}
@ -275,15 +266,3 @@ func (l *LightClient) importBlockIfPossible() {
l.highestSeen = eth1Number
}
}
func (l *LightClient) updateStatus() error {
finalizedRoot, err := l.store.finalizedHeader.HashSSZ()
if err != nil {
return err
}
headRoot, err := l.store.optimisticHeader.HashSSZ()
if err != nil {
return err
}
return l.rpc.SetStatus(finalizedRoot, l.store.finalizedHeader.Slot/32, headRoot, l.store.optimisticHeader.Slot)
}

View File

@ -208,6 +208,8 @@ func New(
s.handshaker = handshake.New(ctx, cfg.GenesisConfig, cfg.BeaconConfig, host, rule)
// removed IdDelta in recent version of libp2p
host.RemoveStreamHandler("/p2p/id/delta/1.0.0")
s.host = host
s.peers = peers.New(s.host)