Created
September 6, 2019 00:59
-
-
Save Dan-Nolan/248684ce7c7f7a5dcd559cb2cf753e84 to your computer and use it in GitHub Desktop.
Verify.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function verifyProof(proof, node, root, concat) { | |
for(let i = 0; i < proof.length; i++) { | |
let { left, data } = proof[i]; | |
if(left) { | |
node = concat(data, node); | |
} | |
else { | |
node = concat(node, data); | |
} | |
} | |
return root.equals(node); | |
} | |
module.exports = verifyProof; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment