test: add invalid segwit transaction test

This commit is contained in:
startup-dreamer 2024-01-19 23:12:08 +05:30
parent 5e3d1295e0
commit fe8d559d69
No known key found for this signature in database
GPG Key ID: 648BF00D6CA32F08
1 changed files with 11 additions and 0 deletions

View File

@ -1638,6 +1638,17 @@ mod tests {
assert_eq!(realtx.base_size(), tx_bytes.len());
}
#[test]
fn segwit_invalid_transaction() {
let tx_bytes = hex!("0000fd000001021921212121212121212121f8b372b0239cc1dff600000000004f4f4f4f4f4f4f4f000000000000000000000000000000333732343133380d000000000000000000000000000000ff000000000009000dff000000000000000800000000000000000d");
let tx: Result<Transaction, _> = deserialize(&tx_bytes);
assert!(tx.is_err());
assert!(tx
.unwrap_err()
.to_string()
.contains("witness flag set but no witnesses present"));
}
#[test]
fn segwit_transaction() {
let tx_bytes = hex!(