Skip to content

Commit 63a75fd

Browse files
authored
fix(trie): intermediate trie node hashes (paradigmxyz#11826)
1 parent e3e83b7 commit 63a75fd

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

crates/trie/sparse/src/trie.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,7 @@ impl RevealedSparseTrie {
345345
} else {
346346
let value = self.values.get(&path).unwrap();
347347
let rlp_node = LeafNodeRef { key, value }.rlp(&mut self.rlp_buf);
348-
if let Some(node_hash) = rlp_node.as_hash() {
349-
*hash = Some(node_hash);
350-
}
348+
*hash = rlp_node.as_hash();
351349
rlp_node
352350
}
353351
}
@@ -360,9 +358,7 @@ impl RevealedSparseTrie {
360358
let (_, child) = rlp_node_stack.pop().unwrap();
361359
self.rlp_buf.clear();
362360
let rlp_node = ExtensionNodeRef::new(key, &child).rlp(&mut self.rlp_buf);
363-
if let Some(node_hash) = rlp_node.as_hash() {
364-
*hash = Some(node_hash);
365-
}
361+
*hash = rlp_node.as_hash();
366362
rlp_node
367363
} else {
368364
path_stack.extend([path, child_path]); // need to get rlp node for child first
@@ -400,9 +396,7 @@ impl RevealedSparseTrie {
400396
self.rlp_buf.clear();
401397
let rlp_node = BranchNodeRef::new(&branch_value_stack_buf, *state_mask)
402398
.rlp(&mut self.rlp_buf);
403-
if let Some(node_hash) = rlp_node.as_hash() {
404-
*hash = Some(node_hash);
405-
}
399+
*hash = rlp_node.as_hash();
406400
rlp_node
407401
}
408402
};

0 commit comments

Comments
 (0)