Skip to content

Commit c6e0fdf

Browse files
committed
f pre-flight checks to use new claimable_balance/HTLC storage format
1 parent b49d713 commit c6e0fdf

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3835,27 +3835,25 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
38353835
valid_mpp = false;
38363836
break;
38373837
}
3838+
if expected_amt_msat.is_some() && expected_amt_msat != Some(htlc.total_msat) {
3839+
log_error!(self.logger, "Somehow ended up with an MPP payment with different total amounts - this should not be reachable!");
3840+
debug_assert!(false);
3841+
valid_mpp = false;
3842+
break;
3843+
}
3844+
expected_amt_msat = Some(htlc.total_msat);
38383845
match &htlc.onion_payload {
38393846
OnionPayload::Spontaneous(_) => {
38403847
// We don't currently support MPP for spontaneous payments, so just check
38413848
// that there's one payment here and move on.
3842-
expected_amt_msat = Some(htlc.value);
38433849
if sources.len() != 1 {
38443850
log_error!(self.logger, "Somehow ended up with an MPP spontaneous payment - this should not be reachable!");
38453851
debug_assert!(false);
38463852
valid_mpp = false;
38473853
break;
38483854
}
38493855
},
3850-
OnionPayload::Invoice(hop_data) => {
3851-
if expected_amt_msat.is_some() && expected_amt_msat != Some(hop_data.total_msat) {
3852-
log_error!(self.logger, "Somehow ended up with an MPP payment with different total amounts - this should not be reachable!");
3853-
debug_assert!(false);
3854-
valid_mpp = false;
3855-
break;
3856-
}
3857-
expected_amt_msat = Some(hop_data.total_msat);
3858-
},
3856+
OnionPayload::Invoice {.. } => {},
38593857
}
38603858

38613859
claimable_amt_msat += htlc.value;

0 commit comments

Comments
 (0)