MCPcopy Create free account
hub / github.com/SeismicSystems/summit / verify

Method verify

types/src/utils.rs:127–150  ·  view source on GitHub ↗
(&self, block_dir: &Path)

Source from the content-addressed store, hash-verified

125
126 #[derive(Clone, Debug, Serialize, Deserialize, Default)]
127 pub struct BlockIndex {
128 block_num_to_filename: HashMap<u64, String>,
129 hash_to_block_num: HashMap<B256, u64>,
130 }
131
132 impl BlockIndex {
133 pub fn new() -> Self {
134 Self::default()
135 }
136
137 pub fn add_block(&mut self, block_number: u64, block_hash: B256, filename: String) {
138 self.block_num_to_filename.insert(block_number, filename);
139 self.hash_to_block_num.insert(block_hash, block_number);
140 }
141
142 pub fn get_block_file(&self, block_number: u64) -> Option<&String> {
143 self.block_num_to_filename.get(&block_number)
144 }
145
146 pub fn get_block_number(&self, block_hash: &B256) -> Option<u64> {
147 self.hash_to_block_num.get(block_hash).copied()
148 }
149
150 pub fn save_to_file<P: AsRef<Path>>(&self, path: P) -> anyhow::Result<()> {
151 let json = serde_json::to_string_pretty(self)?;
152 let mut temp_file = path.as_ref().to_path_buf();
153 temp_file.set_extension("temp");

Callers 2

verify_checkpoint_chainFunction · 0.45
verify_deposit_requestFunction · 0.45

Calls 2

lenMethod · 0.80
get_block_fileMethod · 0.80

Tested by

no test coverage detected