diff --git a/crates/trie/trie/src/updates.rs b/crates/trie/trie/src/updates.rs index 39628e6d52..afad628cd7 100644 --- a/crates/trie/trie/src/updates.rs +++ b/crates/trie/trie/src/updates.rs @@ -38,6 +38,15 @@ impl TrieOp { pub const fn is_update(&self) -> bool { matches!(self, Self::Update(..)) } + + /// Returns reference to updated branch node if operation is [`Self::Update`]. + pub const fn as_update(&self) -> Option<&BranchNodeCompact> { + if let Self::Update(node) = &self { + Some(node) + } else { + None + } + } } /// The aggregation of trie updates.