File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -109,14 +109,15 @@ impl TrieNode {
109
109
}
110
110
111
111
/// Returns the commitment of a [TrieNode::Blinded] node, if `self` is of the
112
- /// [TrieNode::Blinded] variant .
112
+ /// [TrieNode::Blinded] or [TrieNode::Empty] variants .
113
113
///
114
114
/// ## Returns
115
115
/// - `Some(B256)` - The commitment of the blinded node
116
116
/// - `None` - `self` is not a [TrieNode::Blinded] node
117
117
pub const fn blinded_commitment ( & self ) -> Option < B256 > {
118
118
match self {
119
119
Self :: Blinded { commitment } => Some ( * commitment) ,
120
+ Self :: Empty => Some ( EMPTY_ROOT_HASH ) ,
120
121
_ => None ,
121
122
}
122
123
}
@@ -681,6 +682,12 @@ mod test {
681
682
use alloy_trie:: { HashBuilder , Nibbles } ;
682
683
use rand:: prelude:: SliceRandom ;
683
684
685
+ #[ test]
686
+ fn test_empty_blinded ( ) {
687
+ let trie_node = TrieNode :: Empty ;
688
+ assert_eq ! ( trie_node. blinded_commitment( ) . unwrap( ) , EMPTY_ROOT_HASH ) ;
689
+ }
690
+
684
691
#[ test]
685
692
fn test_decode_branch ( ) {
686
693
const BRANCH_RLP : [ u8 ; 83 ] = hex ! ( "f851a0eb08a66a94882454bec899d3e82952dcc918ba4b35a09a84acd98019aef4345080808080808080a05d87a81d9bbf5aee61a6bfeab3a5643347e2c751b36789d988a5b6b163d496518080808080808080" ) ;
You can’t perform that action at this time.
0 commit comments