This commit is contained in:
Giacomo Pasini 2024-12-23 17:34:14 +01:00
parent 720a7f458e
commit f6a3d30039
No known key found for this signature in database
GPG Key ID: FC08489D2D895D4B
2 changed files with 3 additions and 2 deletions

View File

@ -82,7 +82,7 @@ pub fn path_key(path: &[merkle::PathNode]) -> [u8; 32] {
assert_eq!(path.len(), 64);
let mut key = [0u8; 32];
for byte_i in (0..32).rev() {
for byte_i in (0..8).rev() {
let mut byte = 0u8;
for bit_i in 0..8 {
byte <<= 1;

View File

@ -37,7 +37,8 @@ impl LedgerWitness {
pub fn assert_nf_update(&mut self, nf: &Nullifier, path: &[merkle::PathNode]) {
// verify that the path corresponds to the nullifier
assert_eq!(sparse_merkle::path_key(path), nf.0);
let path_key = sparse_merkle::path_key(path);
assert_eq!(path_key[0], 0);
// verify that the nullifier was not already present
assert_eq!(merkle::path_root(sparse_merkle::ABSENT, path), self.nf_root);