From bc14275b92fba5e76680846bac6c8696e9a22824 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Mon, 2 Dec 2024 18:39:44 +0100 Subject: [PATCH] feat(trie): `SparseStateTrie::new` --- crates/trie/sparse/src/state.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/trie/sparse/src/state.rs b/crates/trie/sparse/src/state.rs index 0ca290e2d0cb..cf0bc20abe4f 100644 --- a/crates/trie/sparse/src/state.rs +++ b/crates/trie/sparse/src/state.rs @@ -53,6 +53,18 @@ impl SparseStateTrie { } impl SparseStateTrie { + /// Create new [`SparseStateTrie`] with blinded node provider factory. + pub fn new(provider_factory: F) -> Self { + Self { + provider_factory, + state: Default::default(), + storages: Default::default(), + revealed: Default::default(), + retain_updates: false, + account_rlp_buf: Vec::with_capacity(TRIE_ACCOUNT_RLP_MAX_SIZE), + } + } + /// Set the retention of branch node updates and deletions. pub const fn with_updates(mut self, retain_updates: bool) -> Self { self.retain_updates = retain_updates;