},
}
-impl<K: core::fmt::Debug> core::fmt::Display for InsertDescriptorError<K> {
+impl<K: core::fmt::Display> core::fmt::Display for InsertDescriptorError<K> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
InsertDescriptorError::DescriptorAlreadyAssigned {
- existing_assignment: existing,
+ existing_assignment,
descriptor,
} => {
write!(
f,
- "attempt to re-assign descriptor {descriptor:?} already assigned to {existing:?}"
+ "descriptor '{}' is already in use by another keychain '{}'",
+ descriptor, existing_assignment
)
}
InsertDescriptorError::KeychainAlreadyAssigned {
- existing_assignment: existing,
+ existing_assignment,
keychain,
} => {
write!(
f,
- "attempt to re-assign keychain {keychain:?} already assigned to {existing:?}"
+ "keychain '{}' is already associated with another descriptor '{}'",
+ keychain, existing_assignment
)
}
}
}
#[cfg(feature = "std")]
-impl<K: core::fmt::Debug> std::error::Error for InsertDescriptorError<K> {}
+impl<K: core::fmt::Display + core::fmt::Debug> std::error::Error for InsertDescriptorError<K> {}
/// `ChangeSet` represents persistent updates to a [`KeychainTxOutIndex`].
///
Internal,
}
+impl core::fmt::Display for TestKeychain {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+ match self {
+ TestKeychain::External => write!(f, "External"),
+ TestKeychain::Internal => write!(f, "Internal"),
+ }
+ }
+}
+
fn parse_descriptor(descriptor: &str) -> Descriptor<DescriptorPublicKey> {
let secp = bdk_chain::bitcoin::secp256k1::Secp256k1::signing_only();
Descriptor::<DescriptorPublicKey>::parse_descriptor(&secp, descriptor)