From 28049ce2d9a3072d100f71d9f23c25f96eb97f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ci=C4=99=C5=BCarkiewicz?= Date: Fri, 3 Jun 2022 19:43:45 -0700 Subject: [PATCH] Document `Txid` being displayed backwards Fix #958 --- src/hash_types.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/hash_types.rs b/src/hash_types.rs index 94e46792..49bc52c3 100644 --- a/src/hash_types.rs +++ b/src/hash_types.rs @@ -39,7 +39,15 @@ macro_rules! impl_hashencode { } } -hash_newtype!(Txid, sha256d::Hash, 32, doc="A bitcoin transaction hash/transaction ID."); +hash_newtype!( + Txid, sha256d::Hash, 32, doc="A bitcoin transaction hash/transaction ID. + +For compatibility with the existing Bitcoin infrastructure and historical +and current versions of the Bitcoin Core software itself, this and +other [`sha256d::Hash`] types, are serialized in reverse +byte order when converted to a hex string via [`std::fmt::Display`] trait operations. +See [`hashes::Hash::DISPLAY_BACKWARD`] for more details. +"); hash_newtype!(Wtxid, sha256d::Hash, 32, doc="A bitcoin witness transaction ID."); hash_newtype!(BlockHash, sha256d::Hash, 32, doc="A bitcoin block hash."); hash_newtype!(Sighash, sha256d::Hash, 32, doc="Hash of the transaction according to the signature algorithm");