xpay: fix misleading "route hint" label in error messages
What changed, and why it matters
This commit fixes a wording bug in error messages produced by the xpay plugin. Previously, when an invoice had a single-hop route hint, any failed channel along the payment path could be incorrectly labeled as 'the invoice's route hint' in the error message, even if the failure happened on an unrelated intermediate channel. The fix adds a check that the failed channel actually matches the route hint's channel ID before using that label. This is a user-facing diagnostic improvement, not a security vulnerability.
No security action required. Treat as a normal bug fix / user-experience improvement. Reviewers may optionally verify that the new equality check uses the correct field ordering for short_channel_id_eq.
Security signals we found
No security-relevant code path altered
Change is purely diagnostic/error-message wording
No memory safety, authentication, authorization, or cryptographic change
No input validation or trust boundary change
Evidence from the diff
In plugins/xpay/xpay.c, describe_scidd() constructs human-readable descriptions of short_channel_id_dir values for error reporting. The original code checked only that the payment had exactly one route hint containing exactly one hop, then unconditionally labeled the channel at the given index as ‘the invoice’s route hint’. The patch adds a short_channel_id_eq() comparison between scidd.scid and payment->route_hints[0][0].short_channel_id, so the label is only used when the error actually refers to the route hint channel.
Changed components
plugins/xpay/xpay.cdescribe_scidd() functionxpay error message formattingInspect captured patch +3 / −1
diff --git a/plugins/xpay/xpay.c b/plugins/xpay/xpay.c
index 70001888..43b381eb 100644
--- a/plugins/xpay/xpay.c
+++ b/plugins/xpay/xpay.c
@@ -522,7 +522,9 @@ static const char *describe_scidd(struct attempt *attempt, size_t index)
/* Routehint? Often they are a single hop. */
if (tal_count(payment->route_hints) == 1
- && tal_count(payment->route_hints[0]) == 1)
+ && tal_count(payment->route_hints[0]) == 1
+ && short_channel_id_eq(scidd.scid,
+ payment->route_hints[0][0].short_channel_id))
return tal_fmt(tmpctx, "the invoice's route hint (%s)",
fmt_short_channel_id_dir(tmpctx, &scidd));
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.