projects
/
rust-lightning
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
633f732
)
f - Accept only non-v0 witness programs
author
Jeffrey Czyz
<jkczyz@gmail.com>
Fri, 30 Jul 2021 21:03:01 +0000
(16:03 -0500)
committer
Jeffrey Czyz
<jkczyz@gmail.com>
Sat, 31 Jul 2021 03:49:30 +0000
(22:49 -0500)
lightning/src/ln/script.rs
patch
|
blob
|
history
diff --git
a/lightning/src/ln/script.rs
b/lightning/src/ln/script.rs
index c2987f7393ff5d90e10de8229de1869af456d325..589c3f311936c7885e1363c96b42055465f09991 100644
(file)
--- a/
lightning/src/ln/script.rs
+++ b/
lightning/src/ln/script.rs
@@
-10,6
+10,7
@@
use bitcoin::secp256k1::key::PublicKey;
use ln::features::InitFeatures;
use std::convert::TryFrom;
use ln::features::InitFeatures;
use std::convert::TryFrom;
+use core::num::NonZeroU8;
/// A script pubkey for shutting down a channel as defined by [BOLT #2].
///
/// A script pubkey for shutting down a channel as defined by [BOLT #2].
///
@@
-60,7
+61,8
@@
impl ShutdownScript {
/// # Panics
///
/// This function may panic if given a segwit program with an invalid length.
/// # Panics
///
/// This function may panic if given a segwit program with an invalid length.
- pub fn new_witness_program(version: u5, program: &[u8]) -> Self {
+ pub fn new_witness_program(version: NonZeroU8, program: &[u8]) -> Self {
+ let version = u5::try_from_u8(version.get()).expect("Invalid segwit version");
let script = Script::new_witness_program(version, program);
Self::try_from(script).expect("Invalid segwit program")
}
let script = Script::new_witness_program(version, program);
Self::try_from(script).expect("Invalid segwit program")
}