Skip to content

Commit

Permalink
test: invalid script len test for Address::from_script
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunoia1729 committed Jun 5, 2022
1 parent de17554 commit 56bce1c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/util/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,8 +1430,10 @@ mod tests {
fn test_fail_address_from_script() {
let bad_p2wpkh = hex_script!("0014dbc5b0a8f9d4353b4b54c3db48846bb15abfec");
let bad_p2wsh = hex_script!("00202d4fa2eb233d008cc83206fa2f4f2e60199000f5b857a835e3172323385623");
let invalid_len_script = hex_script!("001161458e330389cd0437ee9fe3641d70cc18");

assert_eq!(Address::from_script(&bad_p2wpkh, Network::Bitcoin), None);
assert_eq!(Address::from_script(&bad_p2wsh, Network::Bitcoin), None);
assert_eq!(Address::from_script(&invalid_len_script, Network::Bitcoin), None);
}
}

0 comments on commit 56bce1c

Please sign in to comment.