Skip to content

Instantly share code, notes, and snippets.

@Dan-Nolan
Created September 6, 2019 00:59
Show Gist options
  • Save Dan-Nolan/248684ce7c7f7a5dcd559cb2cf753e84 to your computer and use it in GitHub Desktop.
Save Dan-Nolan/248684ce7c7f7a5dcd559cb2cf753e84 to your computer and use it in GitHub Desktop.
Verify.js
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