Use chunks_exact

Now that we are going to bump the MSRV above 1.31 we can use
`chunks_exact`.
This commit is contained in:
Tobin C. Harding 2022-04-21 11:29:33 +10:00
parent 3a0097ba49
commit 6410095687
1 changed files with 3 additions and 3 deletions

View File

@ -683,13 +683,13 @@ impl TaprootMerkleBranch {
Err(TaprootError::InvalidMerkleTreeDepth(sl.len() / TAPROOT_CONTROL_NODE_SIZE))
} else {
let inner = sl
// TODO: Use chunks_exact after MSRV changes to 1.31
.chunks(TAPROOT_CONTROL_NODE_SIZE)
.chunks_exact(TAPROOT_CONTROL_NODE_SIZE)
.map(|chunk| {
sha256::Hash::from_slice(chunk)
.expect("chunk exact always returns the correct size")
.expect("chunks_exact always returns the correct size")
})
.collect();
Ok(TaprootMerkleBranch(inner))
}
}