| 660 | } |
| 661 | |
| 662 | static 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 */ |
| 689 | static u32 error_blockheight(const u8 *errmsg) |
no test coverage detected