rust-bitcoin-unsafe-fast/bitcoin/src
Andrew Poelstra 8c4899f2cc
bitcoin: remove all direct use of hashing/engines in unit tests
This is a continuation of the previous commit, but separated to make
review a little easier. This one replaces test vectors that were
previously computed by hashing garbage into Txids and various other hash
types with new test vectors which are directly-computed garbage
converted to hashes with from_byte_array.

In one case (src/hash_types.rs) this results in changing a bunch of
fixed test vectors. This is okay; this test is supposed to check the
direction of string serialization, which is unaffected by this commit
(or any commit in this PR). The existing test vectors, because they hash
the empty string, result in different bytes depending on the underlying
hash algo (sha256, sha256d, sha256t, etc). The new ones just use the
same fixed test vector for all of them.

This commit also updates a doctest in crypto/sighash.rs which
demonstrates how to manually feed sighash data into a hash engine and
correctly handle the sighash single bug. Because you can no longer
directly get a sighash object from an engine, this particular example
should maybe be rewritten to just encode to a Vec rather than a hash
engine, explaining that maybe you'd do this when implementing a HWW, to
verify the exact data being hashed. Or something.

Unrelatedly, you can check that there are no API changes in this commit
or the last several. The next commit will remove GeneralHash impls and
that's when you'll see changes.
2024-06-24 13:58:03 +00:00
..
address Merge rust-bitcoin/rust-bitcoin#2880: Pass hash types by value 2024-06-22 19:42:24 +00:00
blockdata bitcoin: remove all direct use of hashing/engines in unit tests 2024-06-24 13:58:03 +00:00
consensus hashes: split Hash trait into two 2024-06-24 13:28:54 +00:00
crypto bitcoin: remove all direct use of hashing/engines in unit tests 2024-06-24 13:58:03 +00:00
merkle_tree hashes: drop the `all_zeros` method on arbitrary hashes 2024-06-22 15:09:28 +00:00
p2p hashes: drop the `all_zeros` method on arbitrary hashes 2024-06-22 15:09:28 +00:00
psbt bitcoin: remove all use of engine/from_engine on opaque hash types 2024-06-24 13:57:03 +00:00
taproot Remove InvalidInternalKey variant from TaprootBuilderError 2024-06-20 13:03:59 +10:00
bip32.rs bitcoin: remove all use of engine/from_engine on opaque hash types 2024-06-24 13:57:03 +00:00
bip152.rs bitcoin: remove all direct use of hashing/engines in unit tests 2024-06-24 13:58:03 +00:00
bip158.rs bitcoin: remove all use of engine/from_engine on opaque hash types 2024-06-24 13:57:03 +00:00
hash_types.rs bitcoin: remove all direct use of hashing/engines in unit tests 2024-06-24 13:58:03 +00:00
internal_macros.rs Remove usage of blockdata from paths 2024-06-20 12:00:22 +10:00
lib.rs Move merkle_tree hash types 2024-06-17 19:10:23 +00:00
network.rs Remove usage of blockdata from paths 2024-06-20 12:00:22 +10:00
policy.rs Remove usage of blockdata from paths 2024-06-20 12:00:22 +10:00
pow.rs hashes: drop the `all_zeros` method on arbitrary hashes 2024-06-22 15:09:28 +00:00
serde_utils.rs Removed //! spare line at end of headers 2024-05-16 09:59:55 +01:00
sign_message.rs Merge rust-bitcoin/rust-bitcoin#2868: Pass keys by value 2024-06-14 23:56:46 +00:00
test_macros.rs Removed //! spare line at end of headers 2024-05-16 09:59:55 +01:00