1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use crate::{proof_fetcher::ProofFetcher, DbReader};
use aptos_crypto::HashValue;
use aptos_types::{
proof::SparseMerkleProof,
state_store::{state_key::StateKey, state_value::StateValue},
transaction::Version,
};
use std::{collections::HashMap, sync::Arc};
pub struct NoProofFetcher {
reader: Arc<dyn DbReader>,
}
impl NoProofFetcher {
pub fn new(reader: Arc<dyn DbReader>) -> Self {
Self { reader }
}
}
impl ProofFetcher for NoProofFetcher {
fn fetch_state_value_and_proof(
&self,
state_key: &StateKey,
version: Version,
) -> anyhow::Result<(Option<StateValue>, Option<SparseMerkleProof>)> {
Ok((
self.reader.get_state_value_by_version(state_key, version)?,
None,
))
}
fn get_proof_cache(&self) -> HashMap<HashValue, SparseMerkleProof> {
unimplemented!()
}
}