mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
lightningd: prepare internal json routines for listpeerchannels.
We're soon going to call json_add_unsaved_channel and json_add_uncommitted_channel from a new place, where we want the peer state directly included. Based on patch by @vincenzopalazzo. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -32,9 +32,12 @@
|
||||
#include <wally_psbt.h>
|
||||
|
||||
void json_add_uncommitted_channel(struct json_stream *response,
|
||||
const struct uncommitted_channel *uc)
|
||||
const struct uncommitted_channel *uc,
|
||||
/* Only set for listpeerchannels */
|
||||
const struct peer *peer)
|
||||
{
|
||||
struct amount_msat total, ours;
|
||||
|
||||
if (!uc)
|
||||
return;
|
||||
|
||||
@@ -43,6 +46,10 @@ void json_add_uncommitted_channel(struct json_stream *response,
|
||||
return;
|
||||
|
||||
json_object_start(response, NULL);
|
||||
if (peer) {
|
||||
json_add_node_id(response, "peer_id", &peer->id);
|
||||
json_add_bool(response, "peer_connected", peer->connected == PEER_CONNECTED);
|
||||
}
|
||||
json_add_string(response, "state", "OPENINGD");
|
||||
json_add_string(response, "owner", "lightning_openingd");
|
||||
json_add_string(response, "opener", "local");
|
||||
|
||||
Reference in New Issue
Block a user