Skip to content

Commit

Permalink
Merge #86: descriptor: drop to_string_no_chksum method
Browse files Browse the repository at this point in the history
e28d6d4 descriptor: drop `to_string_no_chksum` method (Andrew Poelstra)

Pull request description:

  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

ACKs for top commit:
  delta1:
    ACK e28d6d4
  RCasatta:
    utACK e28d6d4

Tree-SHA512: 73ee261979822906316fac727970ccdb723bee400a9bba789d68b4851b8bf9b2d500dd5c9a22d75b9c43bcfc57e8d1701c83d43f420edcb257e51653ae314744
  • Loading branch information
apoelstra committed Sep 24, 2024
2 parents 090ce14 + e28d6d4 commit f77fa62
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 f77fa62

Please sign in to comment.