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
This commit is contained in:
Tobin C. Harding 2024-08-10 06:40:26 +10:00
parent b6fda6517c
commit 42c7617a46
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 5 additions and 3 deletions

View File

@ -2,6 +2,7 @@ fn main() {}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use bitcoin_hashes::*; use bitcoin_hashes::*;
use bitcoin_hashes::sha256::Midstate;
#[test] #[test]
fn hash160() { fn hash160() {
@ -117,6 +118,9 @@ mod tests {
147, 108, 71, 99, 110, 96, 125, 179, 62, 234, 221, 198, 240, 201, 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( #[derive(
Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Hash, schemars::JsonSchema, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Hash, schemars::JsonSchema,
)] )]
@ -124,9 +128,7 @@ mod tests {
impl sha256t::Tag for TestHashTag { impl sha256t::Tag for TestHashTag {
fn engine() -> sha256::HashEngine { fn engine() -> sha256::HashEngine {
// The TapRoot TapLeaf midstate. sha256::HashEngine::from_midstate(TAP_LEAF_MIDSTATE)
let midstate = sha256::Midstate::from_byte_array(TEST_MIDSTATE);
sha256::HashEngine::from_midstate(midstate, 64)
} }
} }