Merge rust-bitcoin/rust-bitcoin#3449: Fix fuzztest failure

1f8fdc6ccb Fix type used in bytes_hashed addition (Jamil Lambert, PhD)
d37b8a5dd2 Fix HashEngine.length name change to bytes_hashed (Jamil Lambert, PhD)

Pull request description:

  In #3298 `HashEngine.length` was changed to `HashEngine.bytes_hashed` and changed from `usize` to `u64`.

  Behind a `hashes_fuzz` feature gate there were a couple of occurrences of length that had not been updated and caused a fuzztest failure.  These have been updated to the new name and type.

  Fix #3448

ACKs for top commit:
  tcharding:
    ACK 1f8fdc6ccb
  apoelstra:
    ACK 1f8fdc6ccb successfully ran local tests

Tree-SHA512: 980a1f9ec71d7984a172c2f9439281c3bb3f36cccfb5c83fcf7d61b8cfa753ada56f9cbc6e7495c09bc23aa0451ab1ec7dd2e58c1f2a9b8164b3e03129378251
This commit is contained in:
merge-script 2024-10-10 17:43:29 +00:00
commit 1784c514b9
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
2 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ fn from_engine(mut e: HashEngine) -> Hash {
#[cfg(hashes_fuzz)]
fn from_engine(e: HashEngine) -> Hash {
let mut res = e.midstate();
res[0] ^= (e.length & 0xff) as u8;
res[0] ^= (e.bytes_hashed & 0xff) as u8;
Hash(res)
}

View File

@ -91,7 +91,7 @@ macro_rules! engine_input_impl(
for c in inp {
self.buffer[0] ^= *c;
}
self.length += inp.len();
self.bytes_hashed += inp.len() as u64;
}
)
);