connectd: handle custom messages.

This is neater than what we had before, and slightly more general.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON_RPC: `sendcustommsg` now works with any connected peer, even when shutting down a channel.
This commit is contained in:
Rusty Russell
2022-01-29 14:03:05 +10:30
parent f14c0ef76a
commit 1c71c9849b
21 changed files with 215 additions and 394 deletions

View File

@@ -2178,8 +2178,8 @@ def test_sendcustommsg(node_factory):
# This should work since the peer is currently owned by `channeld`
l2.rpc.sendcustommsg(l1.info['id'], msg)
l2.daemon.wait_for_log(
r'{peer_id}-{owner}-chan#[0-9]: \[OUT\] {msg}'.format(
owner='channeld', msg=msg, peer_id=l1.info['id']
r'{peer_id}-{owner}: \[OUT\] {msg}'.format(
owner='connectd', msg=msg, peer_id=l1.info['id']
)
)
l1.daemon.wait_for_log(r'\[IN\] {}'.format(msg))
@@ -2193,8 +2193,8 @@ def test_sendcustommsg(node_factory):
# This should work since the peer is currently owned by `openingd`
l2.rpc.sendcustommsg(l4.info['id'], msg)
l2.daemon.wait_for_log(
r'{peer_id}-{owner}-chan#[0-9]: \[OUT\] {msg}'.format(
owner='openingd', msg=msg, peer_id=l4.info['id']
r'{peer_id}-{owner}: \[OUT\] {msg}'.format(
owner='connectd', msg=msg, peer_id=l4.info['id']
)
)
l4.daemon.wait_for_log(r'\[IN\] {}'.format(msg))