@@ -1158,6 +1158,11 @@ export class LitNodeClientNodeJs
11581158
11591159 const nodeSet = await this . _getNodeSet ( ) ;
11601160
1161+ // get the threshold number of nodes randomly
1162+ const thresholdNodeSet = nodeSet
1163+ . sort ( ( ) => Math . random ( ) - 0.5 )
1164+ . slice ( 0 , this . _getThreshold ( ) ) ;
1165+
11611166 // ========== Get Node Promises ==========
11621167 // Handle promises for commands sent to Lit nodes
11631168 const nodePromises = this . getNodePromises ( ( url : string ) => {
@@ -1178,7 +1183,7 @@ export class LitNodeClientNodeJs
11781183 authMethods : params . authMethods ,
11791184 } ) ,
11801185
1181- nodeSet,
1186+ nodeSet : thresholdNodeSet ,
11821187 signingScheme : 'EcdsaK256Sha256' ,
11831188 } ;
11841189
@@ -1195,7 +1200,7 @@ export class LitNodeClientNodeJs
11951200 const res = await this . handleNodePromises (
11961201 nodePromises ,
11971202 requestId ,
1198- this . _getThreshold ( )
1203+ thresholdNodeSet . length
11991204 ) ;
12001205
12011206 // ========== Handle Response ==========
@@ -1209,7 +1214,7 @@ export class LitNodeClientNodeJs
12091214 logWithRequestId (
12101215 requestId ,
12111216 'pkpSign responseData' ,
1212- JSON . stringify ( responseData , null , 2 )
1217+ JSON . stringify ( responseData )
12131218 ) ;
12141219
12151220 // clean up the response data (as there are double quotes & snake cases in the response)
0 commit comments