Skip to content

Commit 7e9cf27

Browse files
committed
Drop dead code for handling non-MPP payments in claim_funds
1 parent 6b63414 commit 7e9cf27

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
@@ -2314,12 +2314,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
23142314
// we got all the HTLCs and then a channel closed while we were waiting for the user to
23152315
// provide the preimage, so worrying too much about the optimal handling isn't worth
23162316
// it.
2317-
2318-
let is_mpp = true;
23192317
let mut valid_mpp = sources[0].payment_data.total_msat >= expected_amount;
2320-
23212318
for htlc in sources.iter() {
2322-
if !is_mpp || !valid_mpp { break; }
2319+
if !valid_mpp { break; }
23232320
if let None = channel_state.as_ref().unwrap().short_to_id.get(&htlc.prev_hop.short_channel_id) {
23242321
valid_mpp = false;
23252322
}
@@ -2328,8 +2325,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
23282325
let mut errs = Vec::new();
23292326
let mut claimed_any_htlcs = false;
23302327
for htlc in sources.drain(..) {
2331-
if channel_state.is_none() { channel_state = Some(self.channel_state.lock().unwrap()); }
2332-
if (is_mpp && !valid_mpp) || (!is_mpp && (htlc.value < expected_amount || htlc.value > expected_amount * 2)) {
2328+
if !valid_mpp {
2329+
if channel_state.is_none() { channel_state = Some(self.channel_state.lock().unwrap()); }
23332330
let mut htlc_msat_height_data = byte_utils::be64_to_array(htlc.value).to_vec();
23342331
htlc_msat_height_data.extend_from_slice(&byte_utils::be32_to_array(
23352332
self.best_block.read().unwrap().height()));
@@ -2346,10 +2343,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
23462343
claimed_any_htlcs = true;
23472344
} else { errs.push(e); }
23482345
},
2349-
Err(None) if is_mpp => unreachable!("We already checked for channel existence, we can't fail here!"),
2350-
Err(None) => {
2351-
log_warn!(self.logger, "Channel we expected to claim an HTLC from was closed.");
2352-
},
2346+
Err(None) => unreachable!("We already checked for channel existence, we can't fail here!"),
23532347
Ok(()) => claimed_any_htlcs = true,
23542348
}
23552349
}

0 commit comments

Comments
 (0)