Skip to content

Commit 3a121d1

Browse files
committed
f - swap order to check for matching payment purpose then mpp keysend
Before this our logging would be incorrect - if we receive a keysend payment, and there's already a non-keysend payment htlc claimable, we would log/reject that we're failing the htlc because it's mpp keysend. We would've rejected anyway, but our logs would state the wrong reason.
1 parent 69d6e9a commit 3a121d1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3574,15 +3574,15 @@ where
35743574
purpose: $purpose.clone(), htlcs: Vec::new(), onion_fields: None,
35753575
}
35763576
});
3577-
if !self.default_configuration.accept_mpp_keysend && is_keysend && !claimable_payment.htlcs.is_empty() {
3578-
log_trace!(self.logger, "Failing new keysend HTLC with payment_hash {} as we already had an existing keysend HTLC with the same payment hash and our config states we don't accept MPP keysend", log_bytes!(payment_hash.0));
3579-
fail_htlc!(claimable_htlc, payment_hash);
3580-
}
35813577
if $purpose != claimable_payment.purpose {
35823578
let log_keysend = |keysend| if keysend { "keysend" } else { "non-keysend" };
35833579
log_trace!(self.logger, "Failing new {} HTLC with payment_hash {} as we already had an existing {} HTLC with the same payment hash", log_keysend(is_keysend), log_bytes!(payment_hash.0), log_keysend(!is_keysend));
35843580
fail_htlc!(claimable_htlc, payment_hash);
35853581
}
3582+
if !self.default_configuration.accept_mpp_keysend && is_keysend && !claimable_payment.htlcs.is_empty() {
3583+
log_trace!(self.logger, "Failing new keysend HTLC with payment_hash {} as we already had an existing keysend HTLC with the same payment hash and our config states we don't accept MPP keysend", log_bytes!(payment_hash.0));
3584+
fail_htlc!(claimable_htlc, payment_hash);
3585+
}
35863586
if let Some(earlier_fields) = &mut claimable_payment.onion_fields {
35873587
if earlier_fields.check_merge(&mut onion_fields).is_err() {
35883588
fail_htlc!(claimable_htlc, payment_hash);

0 commit comments

Comments
 (0)