Loads the libp2p keypair for the bootnode.
(&self, chain_id: u64)
| 279 | |
| 280 | /// Loads the libp2p keypair for the bootnode. |
| 281 | pub fn keypair(&self, chain_id: u64) -> eyre::Result<Keypair> { |
| 282 | if let Some(mut private_key) = self.private_key { |
| 283 | return SecretKeyLoader::parse(&mut private_key.0).map_err(Into::into); |
| 284 | } |
| 285 | |
| 286 | let key_path = self.priv_path.clone().unwrap_or_else(|| Self::default_key_path(chain_id)); |
| 287 | info!(target: "rollup_node::bootnode", path = %key_path.display(), "Using bootnode P2P key path"); |
| 288 | SecretKeyLoader::load(&key_path).map_err(Into::into) |
| 289 | } |
| 290 | |
| 291 | /// Returns the default key path for the given chain. |
| 292 | pub fn default_key_path(chain_id: u64) -> PathBuf { |
no test coverage detected