Skip to content

Commit

Permalink
fix: always return out-of-range error, regardless of proposal state
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Jan 16, 2024
1 parent d04b67a commit f5f90ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/scores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,11 @@ export async function updateProposalAndVotes(proposalId: string, force = false)
`[scores] Proposal updated ${proposal.id}, ${proposal.space}, ${results.scores_state}, ${votes.length}`
);
} catch (e: any) {
if (proposal.state === 'closed' && e.code === 'ER_WARN_DATA_OUT_OF_RANGE') {
if (e.code === 'ER_WARN_DATA_OUT_OF_RANGE') {
log.info(`[scores] Invalid final scores_total: ${results.scores_total}`, e);
await invalidateProposalScore(proposalId);
if (proposal.state === 'closed') {
await invalidateProposalScore(proposalId);
}
throw new Error('Invalid out of range score');
} else {
throw e;
Expand Down

0 comments on commit f5f90ae

Please sign in to comment.