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)
This commit is contained in:
niftynei 2021-05-19 19:11:03 -05:00 committed by Rusty Russell
parent 5f1ba02ece
commit e6c7928e76
1 changed files with 5 additions and 0 deletions

View File

@ -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);