Merge #893: config: redact RPC credentials in Config Debug impl.

5c3763526d4d2056e3b3dbf679e4c3244d1f4bf3 config: redact RPC credentials in Config Debug impl. (Antoine Poinsot)

Pull request description:

ACKs for top commit:
  jp1ac4:
    ACK 5c3763526d.

Tree-SHA512: 59d54913f25e5745a14ceac9012b5f285c06c3533709563c5dedeb0f0e3a548d7929f90ce698de004ae708deeb33f80061a233c64731fc9f7649d87df2119571
This commit is contained in:
Antoine Poinsot 2023-12-21 15:21:37 +01:00
commit 386b4cb3dd
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -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 {