Skip to content

Commit 175a3e3

Browse files
committed
Add coverage for 0FC channels in monitor_tests
1 parent 2eb7d31 commit 175a3e3

File tree

2 files changed

+255
-186
lines changed

2 files changed

+255
-186
lines changed

lightning/src/ln/chan_utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ pub fn max_htlcs(channel_type: &ChannelTypeFeatures) -> u16 {
6969
483
7070
}
7171
}
72-
/// The weight of a BIP141 witnessScript for a BOLT3's "offered HTLC output" on a commitment transaction, non-anchor variant.
72+
/// The weight of a BIP141 witnessScript for a BOLT3's "offered HTLC output" on a commitment transaction, non-anchor and p2a anchor variant.
7373
pub const OFFERED_HTLC_SCRIPT_WEIGHT: usize = 133;
74-
/// The weight of a BIP141 witnessScript for a BOLT3's "offered HTLC output" on a commitment transaction, anchor variant.
75-
pub const OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS: usize = 136;
74+
/// The weight of a BIP141 witnessScript for a BOLT3's "offered HTLC output" on a commitment transaction, keyed anchor variant.
75+
pub const OFFERED_HTLC_SCRIPT_WEIGHT_KEYED_ANCHORS: usize = 136;
7676

7777
/// The weight of a BIP141 witnessScript for a BOLT3's "received HTLC output" can vary in function of its CLTV argument value.
7878
/// We define a range that encompasses both its non-anchors and anchors variants.
@@ -162,7 +162,7 @@ impl HTLCClaim {
162162
/// Check if a given input witness attempts to claim a HTLC.
163163
#[rustfmt::skip]
164164
pub fn from_witness(witness: &Witness) -> Option<Self> {
165-
debug_assert_eq!(OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS, MIN_ACCEPTED_HTLC_SCRIPT_WEIGHT);
165+
debug_assert_eq!(OFFERED_HTLC_SCRIPT_WEIGHT_KEYED_ANCHORS, MIN_ACCEPTED_HTLC_SCRIPT_WEIGHT);
166166
if witness.len() < 2 {
167167
return None;
168168
}
@@ -181,7 +181,7 @@ impl HTLCClaim {
181181
} else {
182182
None
183183
}
184-
} else if witness_script.len() == OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS {
184+
} else if witness_script.len() == OFFERED_HTLC_SCRIPT_WEIGHT_KEYED_ANCHORS {
185185
// It's possible for the weight of `offered_htlc_script` and `accepted_htlc_script` to
186186
// match so we check for both here.
187187
if witness.len() == 3 && second_to_last.len() == 33 {

0 commit comments

Comments
 (0)