feat(trie): SparseStateTrie::new (#13068)

This commit is contained in:
Roman Krasiuk
2024-12-02 22:07:18 +01:00
committed by GitHub
parent 80d0fb0cda
commit bcfe9ebb25

View File

@ -53,6 +53,18 @@ impl SparseStateTrie {
}
impl<F: BlindedProviderFactory> SparseStateTrie<F> {
/// 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;