Skip to content

Commit 9f6ac82

Browse files
committed
feat(justifications): block already cast votes from being justified
1 parent c73ba61 commit 9f6ac82

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/court/justifications.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,24 @@ module.exports.put = async (event, _context, callback) => {
4040
}
4141

4242
// Verify votes belong to user
43-
for (const voteID of payload.justification.IDs)
44-
if (
45-
(await klerosLiquid.methods
46-
.getVote(
47-
payload.justification.disputeID,
48-
payload.justification.appeal,
49-
voteID
50-
)
51-
.call()).account !== payload.address
52-
)
43+
for (const voteID of payload.justification.IDs) {
44+
const vote = await klerosLiquid.methods
45+
.getVote(
46+
payload.justification.disputeID,
47+
payload.justification.appeal,
48+
voteID
49+
)
50+
.call()
51+
if (vote.account !== payload.address || vote.voted)
5352
return callback(null, {
5453
statusCode: 403,
5554
headers: { 'Access-Control-Allow-Origin': '*' },
5655
body: JSON.stringify({
5756
error:
58-
'Not all of the supplied vote IDs belong to the supplied address.'
57+
'Not all of the supplied vote IDs belong to the supplied address and are not cast.'
5958
})
6059
})
60+
}
6161

6262
// Save justification
6363
await dynamoDB.putItem({

0 commit comments

Comments
 (0)