From 3445abb553055ca5d89851c3dbfe26046382650f Mon Sep 17 00:00:00 2001 From: trueptolemy <823220586@qq.com> Date: Fri, 26 Apr 2019 15:19:04 +0800 Subject: [PATCH] json-rpc: Add failcode info in listforwards --- CHANGELOG.md | 1 + lightningd/peer_htlcs.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed654d85d..b16c8a66e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - JSON API: new plugin `invoice_payment` hook for intercepting invoices before they're paid. - plugin: the `connected` hook can now send an `error_message` to the rejected peer. - Protocol: we now enforce `option_upfront_shutdown_script` if a peer negotiates it. +- JSON API: `listforwards` now includes the local_failed forwards with failcode (Issue [#2435](https://github.com/ElementsProject/lightning/issues/2435), PR [#2524](https://github.com/ElementsProject/lightning/pull/2524)) ### Changed diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index ac2a67a37..a7b5252e5 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -1915,6 +1915,12 @@ static void listforwardings_add_forwardings(struct json_stream *response, struct "fee", "fee_msat"); json_add_string(response, "status", forward_status_name(cur->status)); + if(cur->failcode != 0) { + json_add_num(response, "failcode", cur->failcode); + json_add_string(response, "failreason", + onion_type_name(cur->failcode)); + } + #ifdef COMPAT_V070 /* If a forwarding doesn't have received_time it was created * before we added the tracking, do not include it here. */