rpc_command -- Hook for intercepting and modifying RPC commands
DESCRIPTION
The rpc_command hook allows a plugin to take over any RPC command.
You can optionally specify a filters array, containing the command names you want to intercept: without this, all commands will be sent to this hook. (added in v25.12)
The plugin receives the full JSON-RPC request and may choose to continue, replace the request, or return a custom result or error.
This is a chained hook: only the first plugin that modifies the request or response will take effect. Other plugins will then be ignored and a warning will be logged.
HOOK PAYLOAD
- rpc_command (object): The original JSON-RPC request object.:
- id (one of): The JSON-RPC request id.:
- (string)
- (number)
- (null)
- method (string): The RPC method name.
- params (one of): The parameters passed to the RPC method.:
- (object):
- (array)
- (any type)
- id (one of): The JSON-RPC request id.:
HOOK RETURN
- result (string, optional) (always "continue"): Indicates that lightningd should continue processing the RPC command normally.
- replace (object, optional): Replaces the original JSON-RPC request with a new one.:
- jsonrpc (string) (always "2.0"): The JSON-RPC version.
- id (one of): The JSON-RPC request id.:
- (string)
- (number)
- (null)
- method (string): The RPC method name.
- params (one of): The parameters passed to the RPC method.:
- (object):
- (array)
- (any type)
- return (object, optional): Returns a custom JSON-RPC response to the caller.:
- result (object, optional): Custom result object to return to the caller.:
- error (object, optional): Custom error object to return to the caller.:
- code (integer): JSON-RPC error code.
- message (string): Human-readable error message.