Truncate secret hash using precision

Currently we are attempting to truncate the hash created using
`bitcoin_hashes` by using the "width" formatting parameter instead of
the "precision" parameter. `hex-conservative` truncates with the
"precision" parameter as is expected since a hash is not an integral
type.

Use the formatting string `"{:.16}"` which is the "precision"
formatting parameter.
This commit is contained in:
Tobin C. Harding 2024-08-22 12:07:29 +10:00
parent 4b143d6f9c
commit 3d1ce0d261
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 1 additions and 1 deletions

View File

@ -46,7 +46,7 @@ macro_rules! impl_display_secret {
engine.input(&self.secret_bytes());
let hash = sha256::Hash::from_engine(engine);
f.debug_tuple(stringify!($thing)).field(&format_args!("#{:016x}", hash)).finish()
f.debug_tuple(stringify!($thing)).field(&format_args!("#{:.16}", hash)).finish()
}
}