mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-09 23:38:10 -05:00
chore(trie): do not take self by mutable ref for blinded provider (#15116)
This commit is contained in:
@@ -32,7 +32,7 @@ pub struct RevealedNode {
|
||||
/// Trie node provider for retrieving blinded nodes.
|
||||
pub trait BlindedProvider {
|
||||
/// Retrieve blinded node by path.
|
||||
fn blinded_node(&mut self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError>;
|
||||
fn blinded_node(&self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError>;
|
||||
}
|
||||
|
||||
/// Default blinded node provider factory that creates [`DefaultBlindedProvider`].
|
||||
@@ -57,7 +57,7 @@ impl BlindedProviderFactory for DefaultBlindedProviderFactory {
|
||||
pub struct DefaultBlindedProvider;
|
||||
|
||||
impl BlindedProvider for DefaultBlindedProvider {
|
||||
fn blinded_node(&mut self, _path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
||||
fn blinded_node(&self, _path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ where
|
||||
T: TrieCursorFactory + Clone + Send + Sync,
|
||||
H: HashedCursorFactory + Clone + Send + Sync,
|
||||
{
|
||||
fn blinded_node(&mut self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
||||
fn blinded_node(&self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
||||
let start = enabled!(target: "trie::proof::blinded", Level::TRACE).then(Instant::now);
|
||||
|
||||
let targets = MultiProofTargets::from_iter([(pad_path_to_key(path), HashSet::default())]);
|
||||
@@ -141,7 +141,7 @@ where
|
||||
T: TrieCursorFactory + Clone + Send + Sync,
|
||||
H: HashedCursorFactory + Clone + Send + Sync,
|
||||
{
|
||||
fn blinded_node(&mut self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
||||
fn blinded_node(&self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
||||
let start = enabled!(target: "trie::proof::blinded", Level::TRACE).then(Instant::now);
|
||||
|
||||
let targets = HashSet::from_iter([pad_path_to_key(path)]);
|
||||
|
||||
@@ -245,7 +245,7 @@ impl<P> WitnessBlindedProvider<P> {
|
||||
}
|
||||
|
||||
impl<P: BlindedProvider> BlindedProvider for WitnessBlindedProvider<P> {
|
||||
fn blinded_node(&mut self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
||||
fn blinded_node(&self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
||||
let maybe_node = self.provider.blinded_node(path)?;
|
||||
if let Some(node) = &maybe_node {
|
||||
self.tx
|
||||
|
||||
Reference in New Issue
Block a user