Skip to content
Open
Changes from all commits
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
7 changes: 7 additions & 0 deletions pkg/mpc/key_exchange_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ func (s *ecdhSession) Close() error {
}

func (e *ecdhSession) BroadcastPublicKey() error {
// Peer restart mid-handshake can schedule this broadcast goroutine
// before the local publicKey is populated; crypto/ecdh.(*PublicKey).Bytes
// then panics with nil pointer dereference. Return an error so the
// caller's retrigger logic takes over instead of the goroutine dying.
if e == nil || e.publicKey == nil {
return fmt.Errorf("ecdh session %s has no public key to broadcast yet", e.nodeID)
}
publicKeyBytes := e.publicKey.Bytes()
msg := types.ECDHMessage{
From: e.nodeID,
Expand Down