MCPcopy Create free account
hub / github.com/ElementsProject/lightning / on_rpc_command

Function on_rpc_command

tests/plugins/rpc_command_2.py:11–21  ·  view source on GitHub ↗
(plugin, rpc_command, **kwargs)

Source from the content-addressed store, hash-verified

9
10@plugin.hook("rpc_command")
11def on_rpc_command(plugin, rpc_command, **kwargs):
12 request = rpc_command
13 if request["method"] == "invoice":
14 # Replace part of this command
15 request["params"]["description"] = "rpc_command_2 modified this description"
16 return {"replace": request}
17 elif request["method"] == "sendpay":
18 # Don't allow this command to be executed
19 return {"return": {"error": {"code": -1,
20 "message": "rpc_command_2 cannot do this"}}}
21 return {"result": "continue"}
22
23
24plugin.run()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected