fix(account): use only threshold_t parties for signing instead of all active parties
For 2-of-3 threshold signing, only 2 parties should participate in signing, not all 3. This fixes the 'failed to calculate Bob_mid' error that occurred when all parties tried to sign. Changes: - Modified CreateSigningSession to select exactly threshold_t parties when no signing config exists - For 2-of-3: now selects 2 parties instead of all 3 - Added logging to show party selection details 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
672b6e1630
commit
0ea64e02ae
|
|
@ -732,12 +732,26 @@ func (h *AccountHTTPHandler) CreateSigningSession(c *gin.Context) {
|
|||
zap.String("username", req.Username),
|
||||
zap.Strings("configured_parties", partyIDs))
|
||||
} else {
|
||||
// Use all active parties (original behavior)
|
||||
partyIDs = allActivePartyIDs
|
||||
// For threshold signing, select minimum required parties (threshold_t)
|
||||
// For 2-of-3, we need exactly 2 parties to sign (not all 3)
|
||||
requiredParties := accountOutput.Account.ThresholdT
|
||||
if len(allActivePartyIDs) < requiredParties {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"error": "insufficient active parties for signing",
|
||||
"required": requiredParties,
|
||||
"available": len(allActivePartyIDs),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
logger.Info("Using all active parties for signing",
|
||||
// Select first 'threshold_t' parties
|
||||
partyIDs = allActivePartyIDs[:requiredParties]
|
||||
|
||||
logger.Info("Using minimum required parties for threshold signing",
|
||||
zap.String("username", req.Username),
|
||||
zap.Strings("active_parties", partyIDs))
|
||||
zap.Int("threshold_t", requiredParties),
|
||||
zap.Int("total_active", len(allActivePartyIDs)),
|
||||
zap.Strings("selected_parties", partyIDs))
|
||||
}
|
||||
|
||||
// Check if any of the selected parties is a delegate
|
||||
|
|
|
|||
Loading…
Reference in New Issue