Skip to content

Commit

Permalink
doc-schema: make address field in getinfo response required
Browse files Browse the repository at this point in the history
There were cases where address it's empty, and this cases are not right if the
field is considered optional.
This makes it required and add the field also when `--offline` is set.

Changelog-Changed: JSON-RPC: `getinfo` `address` array is always present (though may be empty)
  • Loading branch information
rustyrussell committed Feb 1, 2023
1 parent dcb9b4b commit 18397c0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions doc/lightning-getinfo.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ On success, an object is returned, containing:
- **blockheight** (u32): The highest block height we've learned
- **network** (string): represents the type of network on the node are working (e.g: `bitcoin`, `testnet`, or `regtest`)
- **fees\_collected\_msat** (msat): Total routing fees collected by this node
- **our\_features** (object, optional): Our BOLT #9 feature bits (as hexstring) for various contexts:
- **init** (hex): features (incl. globalfeatures) in our init message, these also restrict what we offer in open\_channel or accept in accept\_channel
- **node** (hex): features in our node\_announcement message
- **channel** (hex): negotiated channel features we (as channel initiator) publish in the channel\_announcement message
- **invoice** (hex): features in our BOLT11 invoices
- **msatoshi\_fees\_collected** (u64, optional) **deprecated, removal in v23.05**
- **address** (array of objects, optional): The addresses we announce to the world:
- **address** (array of objects): The addresses we announce to the world:
- **type** (string): Type of connection (one of "dns", "ipv4", "ipv6", "torv2", "torv3", "websocket")
- **port** (u16): port number

If **type** is "dns", "ipv4", "ipv6", "torv2" or "torv3":

- **address** (string): address in expected format for **type**
- **our\_features** (object, optional): Our BOLT #9 feature bits (as hexstring) for various contexts:
- **init** (hex): features (incl. globalfeatures) in our init message, these also restrict what we offer in open\_channel or accept in accept\_channel
- **node** (hex): features in our node\_announcement message
- **channel** (hex): negotiated channel features we (as channel initiator) publish in the channel\_announcement message
- **invoice** (hex): features in our BOLT11 invoices
- **msatoshi\_fees\_collected** (u64, optional) **deprecated, removal in v23.05**
- **binding** (array of objects, optional): The addresses we are listening on:
- **type** (string): Type of connection (one of "local socket", "ipv4", "ipv6", "torv2", "torv3")
- **address** (string, optional): address in expected format for **type**
Expand Down Expand Up @@ -133,4 +133,4 @@ RESOURCES

Main web site: <https://github.com/ElementsProject/lightning>

[comment]: # ( SHA256STAMP:cd659304258fa31d104fa4bd41855a699a62777e6b57998fdbc064ffe02a293a)
[comment]: # ( SHA256STAMP:5c7c4d6279279b6c92cd3b039dcb24429214b2460a6ad82bed384796389a9b5c)
3 changes: 2 additions & 1 deletion doc/schemas/getinfo.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"blockheight",
"network",
"fees_collected_msat",
"lightning-dir"
"lightning-dir",
"address"
],
"properties": {
"id": {
Expand Down
5 changes: 3 additions & 2 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -2365,10 +2365,10 @@ static struct command_result *json_getinfo(struct command *cmd,
json_add_num(response, "num_inactive_channels", inactive_channels);

/* Add network info */
json_array_start(response, "address");
if (cmd->ld->listen) {
/* These are the addresses we're announcing */
count_announceable = tal_count(cmd->ld->announceable);
json_array_start(response, "address");
for (size_t i = 0; i < count_announceable; i++)
json_add_address(response, NULL, cmd->ld->announceable+i);

Expand Down Expand Up @@ -2396,8 +2396,9 @@ static struct command_result *json_getinfo(struct command *cmd,
for (size_t i = 0; i < tal_count(cmd->ld->binding); i++)
json_add_address_internal(response, NULL,
cmd->ld->binding+i);
json_array_end(response);
}
json_array_end(response);

json_add_string(response, "version", version());
json_add_num(response, "blockheight", cmd->ld->blockheight);
json_add_string(response, "network", chainparams->network_name);
Expand Down

0 comments on commit 18397c0

Please sign in to comment.