MCPcopy Create free account
hub / github.com/ElementsProject/lightning / outgoing_notify_failure

Function outgoing_notify_failure

plugins/xpay/xpay.c:662–686  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

660}
661
662static void outgoing_notify_failure(const struct attempt *attempt,
663 int failindex, int errcode,
664 const u8 *replymsg,
665 const char *errstr)
666{
667 struct json_stream *js = plugin_notification_start(NULL, "pay_part_end");
668 json_add_string(js, "status", "failure");
669 json_add_attempt_fields(js, attempt);
670 if (replymsg)
671 json_add_hex_talarr(js, "failed_msg", replymsg);
672 json_add_timerel(js, "duration", timemono_between(time_mono(), attempt->start_time));
673 if (failindex != -1) {
674 if (failindex != 0)
675 json_add_pubkey(js, "failed_node_id", &attempt->hops[failindex-1].next_node);
676 if (failindex != tal_count(attempt->hops)) {
677 const struct hop *hop = &attempt->hops[failindex];
678 json_add_short_channel_id(js, "failed_short_channel_id", hop->scidd.scid);
679 json_add_u32(js, "failed_direction", hop->scidd.dir);
680 }
681 }
682 if (errcode != -1)
683 json_add_u32(js, "error_code", errcode);
684 json_add_string(js, "error_message", errstr);
685 plugin_notification_end(attempt->payment->plugin, js);
686}
687
688/* Extract blockheight from the error */
689static u32 error_blockheight(const u8 *errmsg)

Callers 1

Calls 11

json_add_attempt_fieldsFunction · 0.85
json_add_hex_talarrFunction · 0.85
json_add_timerelFunction · 0.85
timemono_betweenFunction · 0.85
time_monoFunction · 0.85
json_add_pubkeyFunction · 0.85
json_add_u32Function · 0.85
plugin_notification_endFunction · 0.85
json_add_stringFunction · 0.50

Tested by

no test coverage detected