xpay: add sub-trace to measure injectpaymentonion
What changed, and why it matters
This commit only adds tracing instrumentation to measure how long the injectpaymentonion operation takes in the xpay plugin. It does not change payment logic, cryptographic handling, network behavior, or access controls. There is no security issue here.
No security action needed. This is a normal observability/logging enhancement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff inserts trace_span_resume, trace_span_start, trace_span_tag, trace_span_end, and trace_span_suspend calls around injectpaymentonion RPC invocations and their success/failure callbacks in plugins/xpay/xpay.c. These are observability-only changes; no functional logic is modified.
Changed components
plugins/xpay/xpay.cInspect captured patch +14 / −0
diff --git a/plugins/xpay/xpay.c b/plugins/xpay/xpay.c
index 7d214ae9..bcd30c1d 100644
--- a/plugins/xpay/xpay.c
+++ b/plugins/xpay/xpay.c
@@ -1225,6 +1225,10 @@ static struct command_result *injectpaymentonion_failed(struct command *aux_cmd,
{
struct payment *payment = attempt->payment;
struct amount_msat amount = attempt->amount;
+ trace_span_resume(attempt->payment);
+ trace_span_resume(attempt);
+ trace_span_end(attempt);
+ trace_span_suspend(attempt->payment);
payment->num_failures++;
@@ -1308,6 +1312,10 @@ static struct command_result *injectpaymentonion_succeeded(struct command *aux_c
{
struct preimage preimage;
struct payment *payment = attempt->payment;
+ trace_span_resume(attempt->payment);
+ trace_span_resume(attempt);
+ trace_span_end(attempt);
+ trace_span_suspend(attempt->payment);
if (!json_to_preimage(buf,
json_get_member(buf, result, "payment_preimage"),
@@ -1473,6 +1481,12 @@ static struct command_result *do_inject(struct command *aux_cmd,
outgoing_notify_start(attempt);
attempt->start_time = time_mono();
+ trace_span_resume(attempt->payment); // payment is the parent span
+ trace_span_start("xpay/injectpaymentonion", attempt);
+ trace_span_tag(attempt, "partid",
+ tal_fmt(attempt, "%d", (int)(attempt->partid)));
+ trace_span_suspend(attempt);
+ trace_span_suspend(attempt->payment);
req = jsonrpc_request_start(aux_cmd,
"injectpaymentonion",
Why this scored 15/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.