Reduces network debug output for regtest and default testnet (#8760)
Co-authored-by: Pili Guerra <mpguerra@users.noreply.github.com>
This commit is contained in:
parent
ec48599cac
commit
9dfb14365f
|
@ -41,7 +41,7 @@ impl From<Network> for NetworkKind {
|
|||
}
|
||||
|
||||
/// An enum describing the possible network choices.
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize)]
|
||||
#[derive(Clone, Default, Eq, PartialEq, Serialize)]
|
||||
#[serde(into = "NetworkKind")]
|
||||
pub enum Network {
|
||||
/// The production mainnet.
|
||||
|
@ -121,6 +121,22 @@ impl fmt::Display for Network {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Network {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Mainnet => write!(f, "{self}"),
|
||||
Self::Testnet(params) if params.is_regtest() => f
|
||||
.debug_struct("Regtest")
|
||||
.field("activation_heights", params.activation_heights())
|
||||
.finish(),
|
||||
Self::Testnet(params) if params.is_default_testnet() => {
|
||||
write!(f, "{self}")
|
||||
}
|
||||
Self::Testnet(params) => f.debug_tuple("ConfiguredTestnet").field(params).finish(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Network {
|
||||
/// Creates a new [`Network::Testnet`] with the default Testnet [`testnet::Parameters`].
|
||||
pub fn new_default_testnet() -> Self {
|
||||
|
|
Loading…
Reference in New Issue