Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/confidential/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::fmt;
use bitcoin::bip32;
use elements::secp256k1_zkp;

use crate::descriptor::checksum::{desc_checksum, verify_checksum};
use crate::descriptor::checksum::{self, verify_checksum};
use crate::descriptor::{
ConversionError, DefiniteDescriptorKey, DescriptorSecretKey, DescriptorPublicKey,
DescriptorXKey, Wildcard
Expand Down Expand Up @@ -189,9 +189,10 @@ impl<Pk: MiniscriptKey + ToPublicKey, T: Extension + ParseableExt> Descriptor<Pk

impl<Pk: MiniscriptKey, T: Extension> fmt::Display for Descriptor<Pk, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let desc_str = format!("ct({},{:#})", self.key, self.descriptor);
let checksum = desc_checksum(&desc_str).map_err(|_| fmt::Error)?;
write!(f, "{}#{}", desc_str, checksum)
use fmt::Write;
let mut wrapped_f = checksum::Formatter::new(f);
write!(wrapped_f, "ct({},{:#})", self.key, self.descriptor)?;
wrapped_f.write_checksum_if_not_alt()
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/descriptor/pegin/dynafed_pegin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use bitcoin::blockdata::script::{self, PushBytes};
use bitcoin::{self, ScriptBuf as BtcScript};
use elements::secp256k1_zkp;

use crate::descriptor::checksum::{desc_checksum, verify_checksum};
use crate::descriptor::checksum::{self, verify_checksum};
use crate::expression::{self, FromTree};
use crate::extensions::{CovExtArgs, CovenantExt};
use crate::policy::{semantic, Liftable};
Expand Down Expand Up @@ -69,9 +69,10 @@ impl<Pk: MiniscriptKey> fmt::Debug for Pegin<Pk> {

impl<Pk: MiniscriptKey> fmt::Display for Pegin<Pk> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let desc = format!("pegin({},{})", self.fed_desc, self.elem_desc);
let checksum = desc_checksum(&desc).map_err(|_| fmt::Error)?;
write!(f, "{}#{}", &desc, &checksum)
use fmt::Write;
let mut wrapped_f = checksum::Formatter::new(f);
write!(wrapped_f, "pegin({},{})", self.fed_desc, self.elem_desc)?;
wrapped_f.write_checksum_if_not_alt()
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/descriptor/pegin/legacy_pegin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use bitcoin::{self, hashes, ScriptBuf as BtcScript};
use bitcoin_miniscript::TranslatePk as BtcTranslatePk;
use elements::secp256k1_zkp;

use crate::descriptor::checksum::{desc_checksum, verify_checksum};
use crate::descriptor::checksum::{self, verify_checksum};
use crate::expression::{self, FromTree};
use crate::extensions::{CovExtArgs, CovenantExt};
use crate::policy::{semantic, Liftable};
Expand Down Expand Up @@ -326,9 +326,10 @@ impl<Pk: MiniscriptKey> fmt::Debug for LegacyPegin<Pk> {

impl<Pk: MiniscriptKey> fmt::Display for LegacyPegin<Pk> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let desc = format!("legacy_pegin({},{})", self.ms, self.desc);
let checksum = desc_checksum(&desc).map_err(|_| fmt::Error)?;
write!(f, "{}#{}", &desc, &checksum)
use fmt::Write;
let mut wrapped_f = checksum::Formatter::new(f);
write!(wrapped_f, "legacy_pegin({},{})", self.ms, self.desc)?;
wrapped_f.write_checksum_if_not_alt()
}
}

Expand Down
Loading