Skip to content

Commit

Permalink
connectd: Make exception for peer_storage messages for using customms…
Browse files Browse the repository at this point in the history
…g and sendcustommsg.
  • Loading branch information
adi2011 committed Jul 2, 2022
1 parent 203b752 commit 14ef49c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion connectd/multiplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,10 @@ static bool handle_custommsg(struct daemon *daemon,
const u8 *msg)
{
enum peer_wire type = fromwire_peektype(msg);
if (type % 2 == 1 && !peer_wire_is_defined(type)) {

/* Making an exception for peer_storage and
* your_peer_storage type of message. */
if (type % 2 == 1 && (type == 7 || type == 9 || !peer_wire_is_defined(type))) {
/* The message is not part of the messages we know how to
* handle. Assuming this is a custommsg, we just forward it to the
* master. */
Expand Down
3 changes: 2 additions & 1 deletion lightningd/connect_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,8 @@ static struct command_result *json_sendcustommsg(struct command *cmd,
return command_param_failed();

type = fromwire_peektype(msg);
if (peer_wire_is_defined(type)) {
/* Allow exception for peer_storage and your_peer_storage msg */
if (type != 7 && type != 9 && peer_wire_is_defined(type)) {
return command_fail(
cmd, JSONRPC2_INVALID_REQUEST,
"Cannot send messages of type %d (%s). It is not possible "
Expand Down

0 comments on commit 14ef49c

Please sign in to comment.