我正在尝试使用 merkletreejs 库测试 merkle 证明,但我不知道为什么会这样
const tree = new MerkleTree(leaves, SHA256)
const root = tree.getHexRoot()
const leaf = SHA256('a')
const proof = tree.getProof(leaf) // РАБОТАЕТ
console.log(tree.verify(proof, leaf, root)) // true
但这不是吗?
const tree = new MerkleTree(leaves, SHA256)
const root = tree.getHexRoot()
const leaf = SHA256('a')
const proof = tree.getHexProof(leaf)
console.log(tree.verify(proof, leaf, root)) // false