-
Notifications
You must be signed in to change notification settings - Fork 908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gossip split #6355
gossip split #6355
Changes from 1 commit
45db07b
8baac40
732c4d7
c55e46d
3abd0fe
cd39e2a
1cf8d43
0c92939
44ef74f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -589,6 +589,76 @@ static const struct json_command addgossip_command = { | |
}; | ||
AUTODATA(json_command, &addgossip_command); | ||
|
||
static struct command_result *json_listprivateinbound(struct command *cmd, | ||
const char *buffer, | ||
const jsmntok_t *obj UNNEEDED, | ||
const jsmntok_t *params) | ||
{ | ||
/* struct node_id *peer_id; */ | ||
struct peer *peer; | ||
/* struct channel *c, **channels; */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove comments... |
||
struct channel *c; | ||
struct json_stream *response; | ||
|
||
if (!param(cmd, buffer, params, NULL)) | ||
return command_param_failed(); | ||
|
||
response = json_stream_success(cmd); | ||
json_array_start(response, "private_channels"); | ||
|
||
/* channels = tal_arr(tmpctx, struct channel *, 0); */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This too |
||
struct peer_node_id_map_iter it; | ||
|
||
for (peer = peer_node_id_map_first(cmd->ld->peers, &it); | ||
peer; | ||
peer = peer_node_id_map_next(cmd->ld->peers, &it)) { | ||
/* json_add_peerchannels(cmd->ld, response, peer); */ | ||
list_for_each(&peer->channels, c, list) { | ||
if (c->state != CHANNELD_NORMAL && | ||
c->state != CHANNELD_AWAITING_SPLICE) | ||
Comment on lines
+642
to
+643
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer new state filters, in this case "if (!channel_can_add_htlc(c->state))". |
||
continue; | ||
|
||
if (c->private_update) { | ||
json_object_start(response, NULL); | ||
json_add_node_id(response, "id", &peer->id); | ||
/* Zeroconf channels will use the local alias here */ | ||
json_add_short_channel_id(response, | ||
"short_channel_id", | ||
&c->private_update->scid); | ||
if (c->alias[REMOTE]) | ||
json_add_short_channel_id(response, | ||
"remote_alias", | ||
c->alias[REMOTE]); | ||
json_add_u32(response, "fee_base", | ||
c->private_update->fee_base); | ||
json_add_u32(response, "fee_ppm", | ||
c->private_update->fee_ppm); | ||
json_add_u32(response, "cltv_delta", | ||
c->private_update->cltv_delta); | ||
json_add_amount_msat(response, "htlc_minimum_msat", | ||
c->private_update->htlc_minimum_msat); | ||
json_add_amount_msat(response, "htlc_maximum_msat", | ||
c->private_update->htlc_maximum_msat); | ||
json_add_hex_talarr(response, "features", peer->their_features); | ||
json_object_end(response); | ||
} | ||
} | ||
} | ||
json_array_end(response); | ||
return command_success(cmd, response); | ||
} | ||
|
||
static const struct json_command listprivateinbound_command = { | ||
"listprivateinbound", | ||
"channels", | ||
json_listprivateinbound, | ||
"Called by plugin to create route hints from incoming private channels", | ||
false, | ||
NULL | ||
}; | ||
|
||
AUTODATA(json_command, &listprivateinbound_command); | ||
|
||
static struct command_result * | ||
json_dev_set_max_scids_encode_size(struct command *cmd, | ||
const char *buffer, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a new API, perhaps we need to enhance listpeerchannels? (optional) remote_private_update object inside that maybe?
In that case, we need to clean it up once channel is public (probably a good idea anyway!) so gossipd needs to tell is when it (first) makes one of our private channels public (i.e. first sees a valid channel_announcement). Note this can fire more than once (lost gossip store!) so don't freak out if we didn't have private info (could happent if they never sent before announcement anyway!).