MCPcopy Create free account
hub / github.com/BitVM/BitVM / lock_scripts_bytes

Method lock_scripts_bytes

bridge/src/connectors/connector_c.rs:198–223  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

196 }
197
198 fn lock_scripts_bytes(&self) -> Vec<Vec<u8>> {
199 let cache_id = spend_info_cache_id(&self.commitment_public_keys);
200 let file_path = get_lock_scripts_cache_path(&cache_id);
201 let lock_scripts_bytes = read_disk_cache(&file_path)
202 .inspect_err(|e| {
203 if e.kind() != std::io::ErrorKind::NotFound {
204 eprintln!(
205 "Failed to read lock scripts cache from expected location: {}",
206 e
207 );
208 }
209 })
210 .unwrap_or_else(|_| generate_assert_leaves(&self.commitment_public_keys));
211 if !file_path.exists() {
212 write_disk_cache(&file_path, &lock_scripts_bytes)
213 .inspect_err(|e| eprintln!("Failed to write lock scripts cache to disk: {}", e))
214 .ok();
215 }
216 cleanup_cache_files(
217 LOCK_SCRIPTS_FILE_PREFIX,
218 file_path.parent().unwrap(),
219 MAX_CACHE_FILES,
220 );
221
222 lock_scripts_bytes
223 }
224}
225
226impl TaprootConnector for ConnectorC {

Calls 6

spend_info_cache_idFunction · 0.85
read_disk_cacheFunction · 0.85
generate_assert_leavesFunction · 0.85
write_disk_cacheFunction · 0.85
cleanup_cache_filesFunction · 0.85

Tested by

no test coverage detected