diff --git a/src/config.rs b/src/config.rs index a1a919d3..f73cda88 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,6 +1,6 @@ use crate::descriptors::LianaDescriptor; -use std::{net::SocketAddr, path::PathBuf, str::FromStr, time::Duration}; +use std::{fmt, net::SocketAddr, path::PathBuf, str::FromStr, time::Duration}; use miniscript::bitcoin::Network; @@ -86,7 +86,7 @@ fn default_daemon() -> bool { } /// RPC authentication options. -#[derive(Debug, Clone, PartialEq, Serialize)] +#[derive(Clone, PartialEq, Serialize)] pub enum BitcoindRpcAuth { /// Path to bitcoind's cookie file. #[serde(rename = "cookie_path")] @@ -96,6 +96,15 @@ pub enum BitcoindRpcAuth { UserPass(String, String), } +impl fmt::Debug for BitcoindRpcAuth { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::CookieFile(path) => path.fmt(f), + Self::UserPass(_, _) => write!(f, "REDACTED RPC CREDENTIALS"), + } + } +} + /// Everything we need to know for talking to bitcoind serenely #[derive(Debug, Clone, Deserialize, Serialize)] pub struct BitcoindConfig {