Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dkg: log peer summary at the start of DKG #1936

Merged
merged 2 commits into from
Mar 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions dkg/dkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ func Run(ctx context.Context, conf Config) (err error) {

log.Info(ctx, "Starting local P2P networking peer", z.Str("local_peer", p2p.PeerName(pID)))

logPeerSummary(ctx, pID, peers, def.Operators)

tcpNode, shutdown, err := setupP2P(ctx, key, conf.P2P, peers, clusterID)
if err != nil {
return err
Expand Down Expand Up @@ -678,3 +680,16 @@ func writeLockToAPI(ctx context.Context, publishAddr string, lock cluster.Lock)

return nil
}

// logPeerSummary logs peer summary with peer names and their ethereum addresses.
func logPeerSummary(ctx context.Context, currentPeer peer.ID, peers []p2p.Peer, operators []cluster.Operator) {
for i, p := range peers {
if p.ID == currentPeer {
log.Info(ctx, "Peer summary", z.Str("peer", p.Name), z.Str("address", operators[i].Address),
z.Int("index", p.Index), z.Str("you", "⭐️"))
dB2510 marked this conversation as resolved.
Show resolved Hide resolved
} else {
log.Info(ctx, "Peer summary", z.Str("peer", p.Name), z.Str("address", operators[i].Address),
z.Int("index", p.Index))
}
}
}