From bcec6bb6cc4c000e75fc51363b32ccb51fc914d6 Mon Sep 17 00:00:00 2001
From: trueptolemy <823220586@qq.com>
Date: Sun, 16 Jun 2019 14:04:10 +0800
Subject: [PATCH] API: 'listforwards' now include 'payment_hash' field

'payment_hash' can help users learn more about the forward payment.
---
 CHANGELOG.md            | 1 +
 lightningd/peer_htlcs.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a9806fe6..f3ab77e3e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - plugins: a new boolean field can be added to a plugin manifest, `dynamic`. It allows a plugin to tell if it can be started or stopped "on-the-fly".
 - lightningd: check bitcoind version when setup topology and confirm the version not older than v0.15.0.
 - startup: space out reconnections on startup if we have more than 5 peers.
+- JSON API: `listforwards` includes the 'payment_hash' field.
 
 ### Deprecated
 
diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c
index 6cc83c7fe..d72d478e8 100644
--- a/lightningd/peer_htlcs.c
+++ b/lightningd/peer_htlcs.c
@@ -2114,6 +2114,9 @@ static void listforwardings_add_forwardings(struct json_stream *response, struct
 		const struct forwarding *cur = &forwardings[i];
 		json_object_start(response, NULL);
 
+		json_add_hex(response, "payment_hash",
+			     cur->payment_hash,
+			     sizeof(*cur->payment_hash));
 		json_add_short_channel_id(response, "in_channel", &cur->channel_in);
 		json_add_short_channel_id(response, "out_channel", &cur->channel_out);
 		json_add_amount_msat_compat(response,