Skip to content

Commit

Permalink
skipIdentity: add implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianFranzen committed May 3, 2024
1 parent 1118589 commit 5eb9837
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/common/src/constraints/CheckCandidates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ export const checkCandidate = async (
);
}

const identityValid = await checkIdentity(constraints.chaindata, candidate);
const identityValid = await checkIdentity(
constraints.config,
constraints.chaindata,
candidate
);
if (!identityValid) {
logger.info(`${candidate.name} identity not valid`, constraintsLabel);
}
Expand Down
6 changes: 6 additions & 0 deletions packages/common/src/constraints/ValidityChecks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,16 @@ export const checkConnectionTime = async (
};

export const checkIdentity = async (
config: Config.ConfigSchema,
chaindata: ChainData,
candidate: Candidate,
): Promise<boolean> => {
try {
const skipIdentity = config.constraints?.skipIdentity || false;
if (skipIdentity) {
await setIdentityInvalidity(candidate, true);
return true;
}
const [hasIdentity, verified] = await chaindata.hasIdentity(
candidate.stash,
);
Expand Down

0 comments on commit 5eb9837

Please sign in to comment.