(&self)
| 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 | |
| 226 | impl TaprootConnector for ConnectorC { |
no test coverage detected