File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -134,11 +134,12 @@ export default async function generateNewVoteFolder(options: Options) {
134134 const GPG_BIN = options . gpgOptions . binaryPath ?? env . GPG_BIN ?? "gpg" ;
135135
136136 const shareHolders = options . shareholders ;
137+ const shareholdersThreshold = Number ( options . shareholdersThreshold ) ;
137138
138139 const { encryptedPrivateKey, publicKey, shares }
139140 = await generateAndSplitKeyPair (
140141 shareHolders . length ,
141- Number ( options . shareholdersThreshold ) ,
142+ shareholdersThreshold ,
142143 ) ;
143144
144145 function toArmordedMessage ( data : ArrayBuffer ) {
@@ -199,6 +200,9 @@ export default async function generateNewVoteFolder(options: Options) {
199200 ) . filter ( String ) ,
200201 canShuffleCandidates : options . canShuffleCandidates ,
201202 } ;
203+ if ( voteConfig . shares . length < shareholdersThreshold ) {
204+ throw new Error ( `You would need ${ shareholdersThreshold } key parts to close the vote, but only ${ voteConfig . shares . length } are available.` ) ;
205+ }
202206 let yamlString = yaml . dump ( voteConfig ) ;
203207 await voteFile . writeFile ( yamlString ) ;
204208 await voteFile . close ( ) ;
You can’t perform that action at this time.
0 commit comments