From 7fb6d94a64f1b6f0ae387e63061e88051e9e59e8 Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Mon, 13 Feb 2023 21:51:50 +0100 Subject: [PATCH] Added more peer count logs (#6865) --- cmd/lightclient/lightclient/checkpoint.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cmd/lightclient/lightclient/checkpoint.go b/cmd/lightclient/lightclient/checkpoint.go index b9c0e438f..2960dde52 100644 --- a/cmd/lightclient/lightclient/checkpoint.go +++ b/cmd/lightclient/lightclient/checkpoint.go @@ -17,10 +17,28 @@ func (l *LightClient) BootstrapCheckpoint(ctx context.Context, finalized [32]byt logInterval := time.NewTicker(10 * time.Second) defer logInterval.Stop() + + doneLogCh := make(chan struct{}) var ( b *cltypes.LightClientBootstrap err error ) + // Start log go routine. + + go func() { + for { + select { + case <-logInterval.C: + peers, err := l.rpc.Peers() + if err != nil { + continue + } + log.Info("[Checkpoint Sync] P2P", "peers", peers) + case <-doneLogCh: + return + } + } + }() for b == nil { b, err = l.rpc.SendLightClientBootstrapReqV1(finalized)