| 48 | + | // With leader rotation a party can form on any of frostMaxJoinLeaderAttempts join attempts, |
| 49 | + | // each bounded by the party timeout, before the signing ceremony itself starts. The wait |
| 50 | + | // adds those attempts and keysignSignatureWaitSlack to the keysign timeout, so a signature |
| 51 | + | // from a party formed on a later attempt, or by a peer that started a little later, still |
| 52 | + | // arrives while this node listens and can abort its own remaining attempts. It is a |
| 53 | + | // best-effort budget, not a hard bound: the keysign timeout is an idle timeout, so a |
| 54 | + | // ceremony that keeps exchanging messages can run past it. |
| 55 | + | func (t *TssServer) keysignSignatureWaitTimeout(version string) time.Duration { |
| 56 | + | if enabled, err := keysignLeaderRotationEnabled(version); err == nil && enabled { |
| 57 | + | return t.conf.KeySignTimeout + keysignSignatureWaitSlack + frostMaxJoinLeaderAttempts*t.conf.PartyTimeout |
| 58 | + | } |
| 59 | + | return t.conf.KeySignTimeout |
| 60 | + | } |
| 61 | + | |
| 40 | 62 | | // keysignJoinAttemptID derives a unique, ephemeral join-party session id for one GG20 |
| 41 | 63 | | // keysign leader-rotation attempt. It reuses p2p.FrostJoinAttemptIDPrefix — the generic |
| 42 | 64 | | // ephemeral-retryable-join marker the coordinator special-cases (an early/stood-down request |
| 43 | 65 | | // is reset, not parked) — and a distinct domain so GG20 digests are disjoint from FROST's. |
| 44 | 66 | | func keysignJoinAttemptID(msgID, leader string, eligiblePeers []string, attempt int) (string, error) { |
| 45 | 67 | | msgID = strings.TrimSpace(msgID) |
| 46 | 68 | | leader = strings.TrimSpace(leader) |
| 47 | 69 | | if msgID == "" || leader == "" || len(eligiblePeers) == 0 || attempt < 0 { |
| 48 | 70 | | return "", errors.New("invalid keysign join attempt context") |