primitives: replace error propagation with `expect`

This error path cannot happen, and if it could, failing formatting is
not the correct source of action, because the std docs say that
formatting may only fail if the formatter says so.

Fixes comment in #4269
This commit is contained in:
Andrew Poelstra 2025-04-21 21:16:41 +00:00
parent 2d8ebb79c3
commit cf42c511d8
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 1 additions and 1 deletions

View File

@ -223,7 +223,7 @@ impl fmt::Display for Header {
self.time.to_u32().to_le_bytes().as_hex(),
self.bits.to_consensus().to_le_bytes().as_hex(),
self.nonce.to_le_bytes().as_hex(),
)?;
).expect("total length of written objects is 160 characters");
fmt::Display::fmt(&buf, f)
}
}