Use const to construct Midstate
As a bit more of an example of how to use the `sha256::Midstate` use a `static` in one of the unit tests.
This commit is contained in:
parent
dcb18bfa7a
commit
86de586898
|
@ -950,17 +950,17 @@ mod tests {
|
||||||
// 32 bytes of zeroes representing "new asset"
|
// 32 bytes of zeroes representing "new asset"
|
||||||
engine.input(&[0; 32]);
|
engine.input(&[0; 32]);
|
||||||
|
|
||||||
let total_bytes_hashed = 64;
|
|
||||||
|
|
||||||
assert_eq!(
|
|
||||||
engine.midstate().expect("total_bytes_hashed is valid"),
|
|
||||||
// RPC output
|
// RPC output
|
||||||
sha256::Midstate::new([
|
static WANT: Midstate = sha256::Midstate::new([
|
||||||
0x0b, 0xcf, 0xe0, 0xe5, 0x4e, 0x6c, 0xc7, 0xd3,
|
0x0b, 0xcf, 0xe0, 0xe5, 0x4e, 0x6c, 0xc7, 0xd3,
|
||||||
0x4f, 0x4f, 0x7c, 0x1d, 0xf0, 0xb0, 0xf5, 0x03,
|
0x4f, 0x4f, 0x7c, 0x1d, 0xf0, 0xb0, 0xf5, 0x03,
|
||||||
0xf2, 0xf7, 0x12, 0x91, 0x2a, 0x06, 0x05, 0xb4,
|
0xf2, 0xf7, 0x12, 0x91, 0x2a, 0x06, 0x05, 0xb4,
|
||||||
0x14, 0xed, 0x33, 0x7f, 0x7f, 0x03, 0x2e, 0x03,
|
0x14, 0xed, 0x33, 0x7f, 0x7f, 0x03, 0x2e, 0x03,
|
||||||
], total_bytes_hashed)
|
], 64);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
engine.midstate().expect("total_bytes_hashed is valid"),
|
||||||
|
WANT,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue