lightningd: remove (most) functions to search channels by status.

This is generally verboten now, since there can be multiple.  There are a
few exceptions:

1. We sometimes want to know if there are *any* active channels.
2. Some dev commands still take peer id when they mean channel_id.
3. We still allow peer id when it's fully determined.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: `close` by peer id will fail if there is more than one live channel (use `channel_id` or `short_channel_id` as id arg).
This commit is contained in:
Rusty Russell
2022-03-23 09:29:20 +10:30
parent f85425d106
commit 21e1d68e3b
11 changed files with 181 additions and 150 deletions

View File

@@ -2586,7 +2586,7 @@ def test_disconnectpeer(node_factory, bitcoind):
mine_funding_to_announce(bitcoind, [l1, l2, l3])
# disconnecting a non gossiping peer results in error
with pytest.raises(RpcError, match=r'Peer is in state CHANNELD_NORMAL'):
with pytest.raises(RpcError, match=r'Peer has \(at least one\) channel in state CHANNELD_NORMAL'):
l1.rpc.disconnect(l3.info['id'])