Skip to content
This repository was archived by the owner on Apr 17, 2020. It is now read-only.

Commit fe66b53

Browse files
committed
jsonrpc: add more fields to listfunds.
This avoids having to correlate with listpeers for the most pertinent information. This API predates plugins, otherwise we'd have listutxos and listpeers and this would simply combine them appropriately. Still, it exists so there's little reason not to make it more friendly. Signed-off-by: Rusty Russell <[email protected]>
1 parent ac1c894 commit fe66b53

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88

99
### Added
10-
- JSON API: `listfunds` now lists a blockheight for confirmed transactions
10+
- JSON API: `listfunds` now lists a blockheight for confirmed transactions,
11+
and has `connected` and `state` fields for channels, like `listpeers`.
1112
- JSON API: `fundchannel_start` now includes field `scriptpubkey`
1213
- JSON API: `txprepare` and `withdraw` now accept an optional parameter `utxos`, a list of utxos to include in the prepared transaction
1314

doc/lightning-listfunds.7

+5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ appended\.
6060
.IP \[bu]
6161
\fIfunding_output\fR - the index of the output in the funding
6262
transaction\.
63+
.IP \[bu]
64+
\fIconnected\fR - whether the channel peer is connected\.
65+
.IP \[bu]
66+
\fIstate\fR - the channel state, in particular \fICHANNELD_NORMAL\fR means the
67+
channel can be used normally\.
6368

6469
.SH AUTHOR
6570

doc/lightning-listfunds.7.md

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ Each entry in *channels* will include:
4545
- *funding\_txid* - funding transaction id.
4646
- *funding\_output* - the index of the output in the funding
4747
transaction.
48+
- *connected* - whether the channel peer is connected.
49+
- *state* - the channel state, in particular *CHANNELD_NORMAL* means the
50+
channel can be used normally.
4851

4952
AUTHOR
5053
------

wallet/walletrpc.c

+5
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,11 @@ static struct command_result *json_listfunds(struct command *cmd,
771771
list_for_each(&p->channels, c, list) {
772772
json_object_start(response, NULL);
773773
json_add_node_id(response, "peer_id", &p->id);
774+
/* Mirrors logic in listpeers */
775+
json_add_bool(response, "connected",
776+
channel_active(c) && c->connected);
777+
json_add_string(response, "state",
778+
channel_state_name(c));
774779
if (c->scid)
775780
json_add_short_channel_id(response,
776781
"short_channel_id",

0 commit comments

Comments
 (0)