Add unit test for deserialize non-standard sighash
It is possible, although not immediately obvious, that it is possible to create a `PsbtSigHashType` with a non-standard value. Add a unit test to show this and also catch any regressions if we accidental change this logic.
This commit is contained in:
parent
e05776f176
commit
8e2422f92b
|
@ -367,3 +367,15 @@ impl Deserialize for TapTree {
|
|||
fn key_source_len(key_source: &KeySource) -> usize {
|
||||
4 + 4 * (key_source.1).as_ref().len()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn can_deserialize_non_standard_psbt_sig_hash_type() {
|
||||
let non_standard_sighash = [222u8, 0u8, 0u8, 0u8]; // 32 byte value.
|
||||
let sighash = PsbtSigHashType::deserialize(&non_standard_sighash);
|
||||
assert!(sighash.is_ok())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue