mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-02 12:44:26 +01:00
lightningd: allow sendcustommsg even if plugins are still processing peer_connected.
This is needed for the next patch, which does this from the peer_connected hook! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Changed: JSON-RPC: `sendcustommsg` can now be called by a plugin from within the `peer_connected` hook.
This commit is contained in:
committed by
Alex Myers
parent
c0b898e860
commit
d7bcac2ae7
@@ -779,11 +779,11 @@ static struct command_result *json_sendcustommsg(struct command *cmd,
|
||||
type_to_string(cmd, struct node_id, dest));
|
||||
}
|
||||
|
||||
if (peer->connected != PEER_CONNECTED)
|
||||
/* We allow messages from plugins responding to peer_connected hook,
|
||||
* so can be PEER_CONNECTING. */
|
||||
if (peer->connected == PEER_DISCONNECTED)
|
||||
return command_fail(cmd, JSONRPC2_INVALID_REQUEST,
|
||||
"Peer is %s",
|
||||
peer->connected == PEER_DISCONNECTED
|
||||
? "not connected" : "still connecting");
|
||||
"Peer is not connected");
|
||||
|
||||
subd_send_msg(cmd->ld->connectd,
|
||||
take(towire_connectd_custommsg_out(cmd, dest, msg)));
|
||||
|
||||
Reference in New Issue
Block a user