Add explanation to witness program version assertion
This commit is contained in:
parent
cc095a4ba7
commit
ab9514983b
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue