feat: display error if proof verify throws, log proof

This commit is contained in:
fryorcraken.eth 2022-10-06 11:07:58 +11:00
parent a8b8fb1513
commit e7e61c67b8
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 18 additions and 10 deletions

View File

@ -324,8 +324,11 @@
messagesDiv.innerHTML += `<li>${msg.msg} - [epoch: ${msg.epoch}, proof: ${msg.proofState} ]</li>`
if (msg.proofState === "verifying...") {
try {
console.log("Verifying proof")
console.time("proof_verify_timer")
const res = msg.verify()
console.time("proof_verify_timer")
console.log("proof verified!", res)
if (res === undefined) {
msg.proofState = "no proof attached"
@ -334,6 +337,10 @@
} else {
msg.proofState = "invalid!"
}
} catch (e) {
msg.proofState = "Error encountered, check console"
console.error("Error verifying proof:", e)
}
updateMessages()
}
})
@ -346,9 +353,10 @@
time.setTime(Number(timestamp));
let proofState, verify;
if (typeof wakuMessage.verify === "undefined") {
if (typeof wakuMessage.rateLimitProof === "undefined") {
proofState = "no proof attached";
} else {
console.log("Proof received:", wakuMessage.rateLimitProof)
verify = wakuMessage.verify.bind(wakuMessage);
proofState = "verifying...";
}