Skip to content

Commit 520a26a

Browse files
committed
fixup! Allow forwarding HTLCs that were constructed for previous config
1 parent 4b54cec commit 520a26a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lightning/src/ln/channel.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -4573,17 +4573,20 @@ impl<Signer: Sign> Channel<Signer> {
45734573
}
45744574

45754575
/// Determines whether the parameters of an incoming HTLC to be forwarded satisfy the channel's
4576-
/// [`ChannelConfig`]. This first looks at the channel's previous [`ChannelConfig`], if any, and
4577-
/// if unsuccessful, falls back to the current one.
4576+
/// [`ChannelConfig`]. This first looks at the channel's current [`ChannelConfig`], and if
4577+
/// unsuccessful, falls back to the previous one if one exists.
45784578
pub fn htlc_satisfies_config(
45794579
&self, htlc: &msgs::UpdateAddHTLC, amt_to_forward: u64, outgoing_cltv_value: u32,
45804580
) -> Result<(), (&'static str, u16)> {
4581+
let res = self.internal_htlc_satisfies_config(&htlc, amt_to_forward, outgoing_cltv_value, &self.config());
4582+
if res.is_ok() {
4583+
return res;
4584+
}
45814585
if let Some(prev_config) = self.prev_config() {
4582-
if self.internal_htlc_satisfies_config(htlc, amt_to_forward, outgoing_cltv_value, &prev_config).is_ok() {
4583-
return Ok(());
4584-
}
4586+
self.internal_htlc_satisfies_config(htlc, amt_to_forward, outgoing_cltv_value, &prev_config)
4587+
} else {
4588+
res
45854589
}
4586-
self.internal_htlc_satisfies_config(&htlc, amt_to_forward, outgoing_cltv_value, &self.config())
45874590
}
45884591

45894592
pub fn get_feerate(&self) -> u32 {

0 commit comments

Comments
 (0)