Skip to content

Commit

Permalink
descriptor: drop to_string_no_chksum method
Browse files Browse the repository at this point in the history
This method has been made redundant by the `{:#}` display specifier
since 7577e8c two years ago. It is
poorly named, inefficient since it always requires allocating a
`String`, and also broken because it uses debug display for keys.

All of our unit tests were converted over to use :# which is why it
wasn't noticed that this method didn't work.

Fixes #34
Fixes #85
  • Loading branch information
apoelstra committed Jun 15, 2024
1 parent 9425f2e commit e28d6d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

- [Removed `to_string_no_chksum`](https://github.com/ElementsProject/elements-miniscript/pull/86). This method was poorly-named and broken. Use the alternate display `{:#}` formatter instead to format descriptors without a checksum.

# 0.3.1 - May 10, 2024

- [Fixed](https://github.com/ElementsProject/elements-miniscript/pull/81) ELIP-151 hash calculation
Expand Down
2 changes: 1 addition & 1 deletion src/descriptor/csfs_cov/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ mod tests {

fn string_rtt(desc_str: &str) {
let desc = Descriptor::<String>::from_str(desc_str).unwrap();
assert_eq!(desc.to_string_no_chksum(), desc_str);
assert_eq!(format!("{:#}", desc), desc_str);
let cov_desc = desc.as_cov().unwrap();
assert_eq!(cov_desc.to_string(), desc.to_string());
}
Expand Down
4 changes: 0 additions & 4 deletions src/descriptor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,6 @@ impl<Pk: MiniscriptKey, Ext: Extension> Descriptor<Pk, Ext> {
}
}

/// Return a string without the checksum
pub fn to_string_no_chksum(&self) -> String {
format!("{:?}", self)
}
/// Checks whether the descriptor is safe.
///
/// Checks whether all the spend paths in the descriptor are possible on the
Expand Down

0 comments on commit e28d6d4

Please sign in to comment.