Skip to content

Commit

Permalink
fix: asserting acc length only one time on load_acc (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaoleal authored Nov 19, 2024
1 parent 0f0cb8f commit 826c5ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/floresta-chain/src/pruned_utreexo/chain_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,9 @@ impl<PersistedState: ChainStore> ChainState<PersistedState> {
let (leaves, _) =
deserialize_partial::<u64>(&leaves).expect("load_acc: Invalid num_leaves");
let mut roots = Vec::new();
// Since we only expect hashes after the num_leaves, the length of the acc have to be a multiple of 32.
assert_eq!(acc.len() % 32, 0);
while acc.len() >= 32 {
// Since we only expect hashes after the num_leaves, it should always align with 32 bytes
assert_eq!(acc.len() % 32, 0);
let root = acc.drain(0..32).collect::<Vec<u8>>();
let root = NodeHash::from(&*root);
roots.push(root);
Expand Down

0 comments on commit 826c5ee

Please sign in to comment.