Skip to content

Commit b0de924

Browse files
committed
Drop dead code for handling non-MPP payments in claim_funds
1 parent fedd89d commit b0de924

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
@@ -2282,12 +2282,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
22822282
// we got all the HTLCs and then a channel closed while we were waiting for the user to
22832283
// provide the preimage, so worrying too much about the optimal handling isn't worth
22842284
// it.
2285-
2286-
let is_mpp = true;
22872285
let mut valid_mpp = sources[0].payment_data.total_msat >= expected_amount;
2288-
22892286
for htlc in sources.iter() {
2290-
if !is_mpp || !valid_mpp { break; }
2287+
if !valid_mpp { break; }
22912288
if let None = channel_state.as_ref().unwrap().short_to_id.get(&htlc.prev_hop.short_channel_id) {
22922289
valid_mpp = false;
22932290
}
@@ -2296,8 +2293,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
22962293
let mut errs = Vec::new();
22972294
let mut claimed_any_htlcs = false;
22982295
for htlc in sources.drain(..) {
2299-
if channel_state.is_none() { channel_state = Some(self.channel_state.lock().unwrap()); }
2300-
if (is_mpp && !valid_mpp) || (!is_mpp && (htlc.value < expected_amount || htlc.value > expected_amount * 2)) {
2296+
if !valid_mpp {
2297+
if channel_state.is_none() { channel_state = Some(self.channel_state.lock().unwrap()); }
23012298
let mut htlc_msat_height_data = byte_utils::be64_to_array(htlc.value).to_vec();
23022299
htlc_msat_height_data.extend_from_slice(&byte_utils::be32_to_array(
23032300
self.best_block.read().unwrap().height()));
@@ -2314,10 +2311,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
23142311
claimed_any_htlcs = true;
23152312
} else { errs.push(e); }
23162313
},
2317-
Err(None) if is_mpp => unreachable!("We already checked for channel existence, we can't fail here!"),
2318-
Err(None) => {
2319-
log_warn!(self.logger, "Channel we expected to claim an HTLC from was closed.");
2320-
},
2314+
Err(None) => unreachable!("We already checked for channel existence, we can't fail here!"),
23212315
Ok(()) => claimed_any_htlcs = true,
23222316
}
23232317
}

0 commit comments

Comments
 (0)