From 42c7617a46b888cd6d7da5ba7ffca37c501d2ddb Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Sat, 10 Aug 2024 06:40:26 +1000 Subject: [PATCH] Fix shchemars test In #3010 we added a `length` field to the `sha256::Midstate` which broke the `schemars` test but we did not notice because of the current bug [0] in the `run_task` CI script. [0] https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools/issues/10 --- hashes/extended_tests/schemars/src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hashes/extended_tests/schemars/src/main.rs b/hashes/extended_tests/schemars/src/main.rs index 2af4690ed..c9f73d40a 100644 --- a/hashes/extended_tests/schemars/src/main.rs +++ b/hashes/extended_tests/schemars/src/main.rs @@ -2,6 +2,7 @@ fn main() {} #[cfg(test)] mod tests { use bitcoin_hashes::*; + use bitcoin_hashes::sha256::Midstate; #[test] fn hash160() { @@ -117,6 +118,9 @@ mod tests { 147, 108, 71, 99, 110, 96, 125, 179, 62, 234, 221, 198, 240, 201, ]; + // The midstate of an empty hash engine tagged with "TapLeaf". + const TAP_LEAF_MIDSTATE: Midstate = Midstate::new(TEST_MIDSTATE, 64); + #[derive( Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Hash, schemars::JsonSchema, )] @@ -124,9 +128,7 @@ mod tests { impl sha256t::Tag for TestHashTag { fn engine() -> sha256::HashEngine { - // The TapRoot TapLeaf midstate. - let midstate = sha256::Midstate::from_byte_array(TEST_MIDSTATE); - sha256::HashEngine::from_midstate(midstate, 64) + sha256::HashEngine::from_midstate(TAP_LEAF_MIDSTATE) } }