home | help
LIGHTNING-HOOK-CUSTOMMSG(7)			     LIGHTNING-HOOK-CUSTOMMSG(7)

NAME
     custommsg -- Hook for handling custom peer messages

DESCRIPTION
     The  custommsg  hook  is the receiving counterpart to the sendcustommsg RPC
     method and is called whenever a peer sends a custom  message  that  is  not
     handled internally by Core Lightning.

     The  goal	of these two components is to allow the implementation of custom
     protocols or prototypes on top of a Core Lightning node, without having  to
     change the node's implementation itself.

     Messages  are  restricted	to odd-numbered types and must not conflict with
     internally handled message types.	These limitations are in place in  order
     to  avoid	conflicts with the internal state tracking, and avoiding discon-
     nections or channel closures, since odd-numbered message can be ignored  by
     nodes (see "it's ok to be odd" in BOLT #1 for details).

     Note  that if the hook registration specifies "filters" then that should be
     a JSON array of message numbers, and the  hook  will  only  be  called  for
     those.   Otherwise,  the hook is called for all messages not handled inter-
     nally. (added in v25.12)

     This is a chained hook and MUST return {"result": "continue"}.

HOOK PAYLOAD
     *	peer_id (pubkey): The node_id of the peer that sent the message.

     *	payload (hex): The raw message payload as a hex string.

	The first two bytes encode the message type  (big-endian),  followed  by
	the  message payload.  The plugin must implement the parsing of the mes-
	sage, including the type prefix, since Core Lightning does not know  how
	to parse the message.

HOOK RETURN
     *	result	(string) (always "continue"): Must always be continue. Any other
	value will cause the hook to fail.

SEE ALSO
     lightning-sendcustommsg(7)

Core Lightning v26.06.1 			     LIGHTNING-HOOK-CUSTOMMSG(7)

home | help