fix(co-sign): fix CanStart() to check T parties for sign sessions
- For keygen sessions: require all N parties to join before starting - For sign sessions: require only T parties to join before starting - This fixes session_started event not being triggered for signing sessions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2a95dd107f
commit
a09e163704
|
|
@ -140,7 +140,15 @@ func (s *MPCSession) UpdateParticipantStatus(partyID value_objects.PartyID, stat
|
||||||
|
|
||||||
// CanStart checks if all participants have joined and the session can start
|
// CanStart checks if all participants have joined and the session can start
|
||||||
func (s *MPCSession) CanStart() bool {
|
func (s *MPCSession) CanStart() bool {
|
||||||
if len(s.Participants) != s.Threshold.N() {
|
// Determine required participant count based on session type
|
||||||
|
// For keygen: all N parties must participate
|
||||||
|
// For sign: only T parties participate
|
||||||
|
requiredCount := s.Threshold.N()
|
||||||
|
if s.SessionType == SessionTypeSign {
|
||||||
|
requiredCount = s.Threshold.T()
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(s.Participants) != requiredCount {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,7 +159,7 @@ func (s *MPCSession) CanStart() bool {
|
||||||
readyCount++
|
readyCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return readyCount == s.Threshold.N()
|
return readyCount == requiredCount
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start transitions the session to in_progress
|
// Start transitions the session to in_progress
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue