mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
json-rpc: Restrict custommsgs to be odd-typed
This solves a couple of issues with the need to synchronously drop the connection in case we were required to understand what the peer was talking about while still allowing users to experiment, just not kill connections.
This commit is contained in:
@@ -2096,6 +2096,12 @@ def test_sendcustommsg(node_factory):
|
||||
with pytest.raises(RpcError, match=r'Cannot send messages of type 18 .WIRE_PING.'):
|
||||
l2.rpc.dev_sendcustommsg(l2.info['id'], r'0012')
|
||||
|
||||
# The sendcustommsg RPC call is currently limited to odd-typed messages,
|
||||
# since they will not result in disconnections or even worse channel
|
||||
# failures.
|
||||
with pytest.raises(RpcError, match=r'Cannot send even-typed [0-9]+ custom message'):
|
||||
l2.rpc.dev_sendcustommsg(l2.info['id'], r'00FE')
|
||||
|
||||
# This should work since the peer is currently owned by `channeld`
|
||||
l2.rpc.dev_sendcustommsg(l1.info['id'], msg)
|
||||
l2.daemon.wait_for_log(
|
||||
|
||||
Reference in New Issue
Block a user