topology: don't show private nodes in listnodes.

This breaks our tests a bit, which assumed we can always see ourselves
even if we don't have a proper channel.

Usually we would deprecate this first, but it's unlikely to break
anyone since it's a bit obscure that this worked at all.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: `listnodes` no longer shows private (peer) nodes: use listpeers
This commit is contained in:
Rusty Russell 2023-12-13 16:05:43 +10:30
parent f61ba7b332
commit ea0d00e677
3 changed files with 5 additions and 4 deletions

View File

@ -1662,7 +1662,8 @@ class NodeFactory(object):
# Make sure we have all node announcements, too
for n in nodes:
for n2 in nodes:
wait_for(lambda: 'alias' in only_one(n.rpc.listnodes(n2.info['id'])['nodes']))
alias = n2.rpc.getinfo()['alias']
wait_for(lambda: [n.get('alias') for n in n.rpc.listnodes(n2.info['id'])['nodes']] == [alias])
def line_graph(self, num_nodes, fundchannel=True, fundamount=FUNDAMOUNT, wait_for_announce=False, opts=None, announce_channels=True):
""" Create nodes, connect them and optionally fund channels.

View File

@ -515,7 +515,7 @@ static struct command_result *json_listnodes(struct command *cmd,
NULL))
return command_param_failed();
gossmap = get_gossmap(false);
gossmap = get_gossmap(true);
js = jsonrpc_stream_success(cmd);
json_array_start(js, "nodes");
if (id) {

View File

@ -136,8 +136,8 @@ def test_splice_listnodes(node_factory, bitcoind):
bitcoind.generate_block(7)
assert len(l1.rpc.listnodes()['nodes']) == 2
assert len(l2.rpc.listnodes()['nodes']) == 2
wait_for(lambda: len(l1.rpc.listnodes()['nodes']) == 2)
wait_for(lambda: len(l2.rpc.listnodes()['nodes']) == 2)
@pytest.mark.openchannel('v1')