Skip to content

allow disabling the checksum with alternate Display#478

Merged
sanket1729 merged 3 commits intorust-bitcoin:masterfrom
apoelstra:2022-10--alt-display
Oct 18, 2022
Merged

allow disabling the checksum with alternate Display#478
sanket1729 merged 3 commits intorust-bitcoin:masterfrom
apoelstra:2022-10--alt-display

Conversation

@apoelstra
Copy link
Copy Markdown
Member

Fixes #477

This will let us avoid some allocations when formatting descriptors,
and make it simpler to selectively append a checksum.
This allows us to remove the checksum with {:#}, and avoid extra
allocations in all cases. Deprecates the old to_string_no_checksum()
methods, which were inefficient and (in the case of Taproot) not
even exported.

Fixes rust-bitcoin#477
Copy link
Copy Markdown
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 7f5bbdf. The nit is just a stylistic comment.

impl<'f, 'a> fmt::Write for Formatter<'f, 'a> {
fn write_str(&mut self, s: &str) -> fmt::Result {
self.fmt.write_str(s)?;
if self.eng.input(s).is_ok() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This can be written as self.engine.input(s).map_err(|| fmt::Error)

@sanket1729 sanket1729 merged commit 72dab64 into rust-bitcoin:master Oct 18, 2022
@apoelstra apoelstra deleted the 2022-10--alt-display branch October 18, 2022 19:00
sanket1729 added a commit to sanket1729/elements-miniscript that referenced this pull request Oct 21, 2022
…022_10

72dab64 (HEAD -> master, upstream/master, origin/master, origin/HEAD) Merge rust-bitcoin/rust-miniscript#478: allow disabling the checksum with alternate `Display`

Also had to fix a bunch of test cases with bare descriptors without el
prefix.
Add a small API to get the nested segwit descriptors without the el
prefix
heap-coder added a commit to heap-coder/rust-miniscript that referenced this pull request Sep 27, 2025
…with alternate `Display`

7f5bbdf379db2357dd6449e991805dcceb93106a fixes for 1.41.0 (Andrew Poelstra)
7577e8ceda6d7c83be4f4422ec9be39c11f9050c checksum: use wrapper around fmt::Formatter for all descriptor types (Andrew Poelstra)
84f02921b7b5a617959137c7c9a136e3c1d88f61 checksum: pull computation apart into an engine (Andrew Poelstra)

Pull request description:

  Fixes #477

ACKs for top commit:
  sanket1729:
    ACK 7f5bbdf379db2357dd6449e991805dcceb93106a. The nit is just a stylistic comment.

Tree-SHA512: f4a5bd67bf15d6e59258ec42f0b046b8321103f1baa0e2f893d4e3379623c636f2092596c0c79a0d3b949a436307f052efca72ad2784e42dd23ad861e3036e85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature request: # flag should turn off checksum when formatting descriptors

2 participants