We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cafc7e4 + b28c6d9 commit f05b0a2Copy full SHA for f05b0a2
1 file changed
pkg/mpc/key_exchange_session.go
@@ -152,6 +152,13 @@ func (s *ecdhSession) Close() error {
152
}
153
154
func (e *ecdhSession) BroadcastPublicKey() error {
155
+ // Peer restart mid-handshake can schedule this broadcast goroutine
156
+ // before the local publicKey is populated; crypto/ecdh.(*PublicKey).Bytes
157
+ // then panics with nil pointer dereference. Return an error so the
158
+ // caller's retrigger logic takes over instead of the goroutine dying.
159
+ if e == nil || e.publicKey == nil {
160
+ return fmt.Errorf("ecdh session %s has no public key to broadcast yet", e.nodeID)
161
+ }
162
publicKeyBytes := e.publicKey.Bytes()
163
msg := types.ECDHMessage{
164
From: e.nodeID,
0 commit comments