Add explanation to witness program version assertion

This commit is contained in:
Steven Roose 2020-10-23 17:28:22 +01:00
parent cc095a4ba7
commit ab9514983b
No known key found for this signature in database
GPG Key ID: 2F2A88D7F8D68E87
1 changed files with 1 additions and 1 deletions

View File

@ -252,7 +252,7 @@ impl Script {
/// Generates P2WSH-type of scriptPubkey with a given hash of the redeem script /// Generates P2WSH-type of scriptPubkey with a given hash of the redeem script
pub fn new_witness_program(ver: ::bech32::u5, program: &[u8]) -> Script { pub fn new_witness_program(ver: ::bech32::u5, program: &[u8]) -> Script {
let mut verop = ver.to_u8(); let mut verop = ver.to_u8();
assert!(verop <= 16); assert!(verop <= 16, "incorrect witness version provided: {}", verop);
if verop > 0 { if verop > 0 {
verop = 0x50 + verop; verop = 0x50 + verop;
} }