Skip to content

Commit 06befaa

Browse files
author
Hugh Cunningham
committed
rejects clients joining full dkg sessions
if the maximum number of participants (according to the session config) have already joined a DKG session then the server prevents new clients from joining the session and returns an error message
1 parent f90e22c commit 06befaa

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/errors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const MultisigBrokerErrorCodes = {
1111
INVALID_SIGNING_SESSION_ID: 4,
1212
IDENTITY_NOT_ALLOWED: 5,
1313
NON_SESSION_CLIENT: 6,
14+
DKG_SESSION_FULL: 7,
1415
}
1516

1617
export class MessageMalformedError extends Error {

src/server.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,16 @@ export class MultisigServer {
567567
return
568568
}
569569

570+
if (isDkgSession(session) && session.clientIds.size >= session.status.maxSigners) {
571+
this.sendErrorMessage(
572+
client,
573+
message.id,
574+
'DKG session is full',
575+
MultisigBrokerErrorCodes.DKG_SESSION_FULL,
576+
)
577+
return
578+
}
579+
570580
this.logger.debug(`Client ${client.id} joined session ${message.sessionId}`)
571581

572582
this.addClientToSession(client, message.sessionId)

0 commit comments

Comments
 (0)