Skip to content

Commit 94e70b8

Browse files
cdeckerrustyrussell
authored andcommitted
pay: Print the HTLC result as soon as it's known
We used to not print what happened with an HTLC in the `pay` plugin. This meant that to follow the HTLCs we'd have to map the `pay` HTLCs to the `lightningd` HTLCs, and then trace that. BY having `pay` print the outcome as it sees it, we can make that tracking much simpler, even allowing for tooling to do it for us. Changelog-None This is a log-only change
1 parent 9df9441 commit 94e70b8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

plugins/libplugin-pay.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,10 @@ payment_waitsendpay_finished(struct command *cmd,
16391639
payment_result_infer(p->route, p->result);
16401640

16411641
if (p->result->state == PAYMENT_COMPLETE) {
1642+
paymod_log(p, LOG_INFORM,
1643+
"HTLC result state=success, sent=%s, deliver=%s",
1644+
fmt_amount_msat(tmpctx, p->result->amount_sent),
1645+
fmt_amount_msat(tmpctx, p->final_amount));
16421646
payment_set_step(p, PAYMENT_STEP_SUCCESS);
16431647
return payment_continue(p);
16441648
}
@@ -1657,9 +1661,23 @@ payment_waitsendpay_finished(struct command *cmd,
16571661
payment_addgossip_success,
16581662
payment_addgossip_failure, p);
16591663
json_add_hex_talarr(req->js, "message", update);
1664+
1665+
paymod_log(p, LOG_INFORM,
1666+
"HTLC result state=failed, sent=%s, todeliver=%s, "
1667+
"code=%d (%s)",
1668+
fmt_amount_msat(tmpctx, p->result->amount_sent),
1669+
fmt_amount_msat(tmpctx, p->final_amount),
1670+
p->result->code, p->result->failcodename);
1671+
16601672
return send_outreq(req);
16611673
}
16621674

1675+
paymod_log(
1676+
p, LOG_INFORM,
1677+
"HTLC result state=failed, sent=%s, todeliver=%s, code=%d (%s)",
1678+
fmt_amount_msat(tmpctx, p->result->amount_sent),
1679+
fmt_amount_msat(tmpctx, p->final_amount), p->result->code,
1680+
p->result->failcodename);
16631681
return payment_addgossip_success(cmd, NULL, NULL, NULL, p);
16641682
}
16651683

0 commit comments

Comments
 (0)