From e6c7928e768fcd29326b32dba55884e24be5334b Mon Sep 17 00:00:00 2001 From: niftynei Date: Wed, 19 May 2021 19:11:03 -0500 Subject: [PATCH] listpeers: show the inflight's 'commitment tx' txid Changelog-Added: EXPERIMENTAL JSON-RPC: `listpeers` now includes the `scratch_txid` for every inflight (if is a dual-funded channel) --- lightningd/peer_control.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 983b2db94..2d4f3dfd9 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -797,6 +797,8 @@ static void json_add_channel(struct lightningd *ld, /* List the inflights */ json_array_start(response, "inflight"); list_for_each(&channel->inflights, inflight, list) { + struct bitcoin_txid txid; + json_object_start(response, NULL); json_add_txid(response, "funding_txid", &inflight->funding->txid); @@ -813,6 +815,9 @@ static void json_add_channel(struct lightningd *ld, json_add_amount_sat_only(response, "our_funding_msat", inflight->funding->our_funds); + /* Add the expected commitment tx id also */ + bitcoin_txid(inflight->last_tx, &txid); + json_add_txid(response, "scratch_txid", &txid); json_object_end(response); } json_array_end(response);