Blinds the [`TrieNode`].. Alternatively, if the [`TrieNode`] is a [`TrieNode::Blinded`] node already, its commitment is returned directly.
(&self)
| 110 | /// Blinds the [`TrieNode`].. Alternatively, if the [`TrieNode`] is a [`TrieNode::Blinded`] node |
| 111 | /// already, its commitment is returned directly. |
| 112 | pub fn blind(&self) -> B256 { |
| 113 | match self { |
| 114 | Self::Blinded { commitment } => *commitment, |
| 115 | Self::Empty => EMPTY_ROOT_HASH, |
| 116 | _ => { |
| 117 | let mut rlp_buf = Vec::with_capacity(self.length()); |
| 118 | self.encode(&mut rlp_buf); |
| 119 | keccak256(rlp_buf) |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /// Unblinds the [`TrieNode`] if it is a [`TrieNode::Blinded`] node. |
| 125 | pub fn unblind<F: TrieProvider>(&mut self, fetcher: &F) -> TrieNodeResult<()> { |