From 0cea90d505c0741220bf902ecf22ca5d87333375 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 28 Feb 2024 10:10:46 +1100 Subject: [PATCH] Test hashes honour Formatter::precision Test that the new version of `hex` honours `Formatter::precision` for new wrapped hash types (ie, types created with `hashes::hash_newtype`). Fix: #2494 --- bitcoin/src/blockdata/transaction.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs index f957e702..c18d43cb 100644 --- a/bitcoin/src/blockdata/transaction.rs +++ b/bitcoin/src/blockdata/transaction.rs @@ -1960,6 +1960,10 @@ mod tests { format!("{:x}", tx.compute_txid()), "9652aa62b0e748caeec40c4cb7bc17c6792435cc3dfe447dd1ca24f912a1c6ec" ); + assert_eq!( + format!("{:.10x}", tx.compute_txid()), + "9652aa62b0" + ); assert_eq!(tx.weight(), Weight::from_wu(2718)); // non-segwit tx from my mempool