Skip to content

Commit

Permalink
lightningd: allow sending of even messages.
Browse files Browse the repository at this point in the history
It's your funeral!

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Sep 18, 2023
1 parent c8594fd commit 6b54ee9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
8 changes: 3 additions & 5 deletions doc/lightning-sendcustommsg.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ top, not for direct use by end-users.

The message must be a hex encoded well-formed message, including the 2-byte
type prefix, but excluding the length prefix which will be added by the RPC
method. The messages must not use even-numbered types, since these may require
synchronous handling on the receiving side, and can cause the connection to be
dropped. The message types may also not use one of the internally handled
method. The message types may not be one of the internally handled
types, since that may cause issues with the internal state tracking of
Core Lightning.
Core Lightning. We do (as of *v23.11*) allow sending of even types, but note that peers (as per the spec) will disconnect on receiving unknown even types.

The node specified by `node_id` must be a peer, i.e., it must have a direct
connection with the node receiving the RPC call, and the connection must be
Expand All @@ -33,7 +31,7 @@ not have a connection, or are synchronous daemons that do not handle
spontaneous messages.

On the reveiving end a plugin may implement the `custommsg` plugin hook and
get notified about incoming messages.
get notified about incoming messages, and allow additional unknown even types in their getmanifest response.

RETURN VALUE
------------
Expand Down
10 changes: 0 additions & 10 deletions lightningd/connect_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,16 +782,6 @@ static struct command_result *json_sendcustommsg(struct command *cmd,
type, peer_wire_name(type));
}

if (type % 2 == 0) {
return command_fail(
cmd, JSONRPC2_INVALID_REQUEST,
"Cannot send even-typed %d custom message. Currently "
"custom messages are limited to odd-numbered message "
"types, as even-numbered types might result in "
"disconnections.",
type);
}

peer = peer_by_id(cmd->ld, dest);
if (!peer) {
return command_fail(cmd, JSONRPC2_INVALID_REQUEST,
Expand Down

0 comments on commit 6b54ee9

Please sign in to comment.