Merge rust-bitcoin/rust-bitcoin#1037: Document `Txid` being displayed backwards

28049ce2d9 Document `Txid` being displayed backwards (Dawid Ciężarkiewicz)

Pull request description:

  Fix #958

  I hope putting it on the most notorious type where people actually notice it is enough. I couldn't find a good way to put it on all other `sha256d` automatically, and copy pasting it seems not worth it.

ACKs for top commit:
  tcharding:
    ACK 28049ce2d9
  apoelstra:
    ACK 28049ce2d9

Tree-SHA512: a5acf5d7a73361a6c48b45ed264fafb911930ae9f1bdb03895dc39c679d508dc56dbf44896fd38cf6569abb652e7fce721028ef06344462747a77078ef5a8f4f
This commit is contained in:
Andrew Poelstra 2022-06-06 11:34:49 +00:00
commit a9365375c1
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 9 additions and 1 deletions

View File

@ -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");