Skip to content

Commit bfa0daa

Browse files
committed
Drop dead code for handling non-MPP payments in claim_funds
1 parent 644eda0 commit bfa0daa

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,12 +2277,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
22772277
// we got all the HTLCs and then a channel closed while we were waiting for the user to
22782278
// provide the preimage, so worrying too much about the optimal handling isn't worth
22792279
// it.
2280-
2281-
let is_mpp = true;
22822280
let mut valid_mpp = sources[0].payment_data.total_msat >= expected_amount;
2283-
22842281
for htlc in sources.iter() {
2285-
if !is_mpp || !valid_mpp { break; }
2282+
if !valid_mpp { break; }
22862283
if let None = channel_state.as_ref().unwrap().short_to_id.get(&htlc.prev_hop.short_channel_id) {
22872284
valid_mpp = false;
22882285
}
@@ -2291,8 +2288,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
22912288
let mut errs = Vec::new();
22922289
let mut claimed_any_htlcs = false;
22932290
for htlc in sources.drain(..) {
2294-
if channel_state.is_none() { channel_state = Some(self.channel_state.lock().unwrap()); }
2295-
if (is_mpp && !valid_mpp) || (!is_mpp && (htlc.value < expected_amount || htlc.value > expected_amount * 2)) {
2291+
if !valid_mpp {
2292+
if channel_state.is_none() { channel_state = Some(self.channel_state.lock().unwrap()); }
22962293
let mut htlc_msat_height_data = byte_utils::be64_to_array(htlc.value).to_vec();
22972294
htlc_msat_height_data.extend_from_slice(&byte_utils::be32_to_array(
22982295
self.best_block.read().unwrap().height()));
@@ -2309,10 +2306,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
23092306
claimed_any_htlcs = true;
23102307
} else { errs.push(e); }
23112308
},
2312-
Err(None) if is_mpp => unreachable!("We already checked for channel existence, we can't fail here!"),
2313-
Err(None) => {
2314-
log_warn!(self.logger, "Channel we expected to claim an HTLC from was closed.");
2315-
},
2309+
Err(None) => unreachable!("We already checked for channel existence, we can't fail here!"),
23162310
Ok(()) => claimed_any_htlcs = true,
23172311
}
23182312
}

0 commit comments

Comments
 (0)