fix(server-party): include self in participants list for keygen

The JoinSession response contains OtherParties (excluding self) and
PartyIndex (self's index). The participants list passed to TSS keygen
must include all parties including self, otherwise validation fails
with "invalid party count" error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-06 00:01:14 -08:00
parent 54061b4c16
commit b51d5687b2
1 changed files with 16 additions and 4 deletions

View File

@ -637,16 +637,28 @@ func (c *MessageRouterClient) JoinSession(
}
// Convert response to SessionInfo
participants := make([]use_cases.ParticipantInfo, len(resp.OtherParties))
for i, p := range resp.OtherParties {
// Include both other parties AND self in the participants list
participants := make([]use_cases.ParticipantInfo, 0, len(resp.OtherParties)+1)
// Add self first
participants = append(participants, use_cases.ParticipantInfo{
PartyID: partyID,
PartyIndex: int(resp.PartyIndex),
})
logger.Debug("Added self to participants",
zap.String("party_id", partyID),
zap.Int32("party_index", resp.PartyIndex))
// Add other parties
for _, p := range resp.OtherParties {
logger.Debug("Received party_index from Message Router",
zap.String("party_id", p.PartyId),
zap.Int32("party_index", p.PartyIndex))
participants[i] = use_cases.ParticipantInfo{
participants = append(participants, use_cases.ParticipantInfo{
PartyID: p.PartyId,
PartyIndex: int(p.PartyIndex),
}
})
}
sessionInfo := &use_cases.SessionInfo{