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

Function rpc_command_hook_final

lightningd/jsonrpc.c:886–917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

884}
885
886static void rpc_command_hook_final(struct rpc_command_hook_payload *p STEALS)
887{
888 const jsmntok_t *params;
889
890 /* Free payload with cmd */
891 tal_steal(p->cmd, p);
892
893 if (p->custom_result != NULL) {
894 struct json_stream *s = json_start(p->cmd);
895 json_add_jsonstr(s, "result",
896 p->custom_result, strlen(p->custom_result));
897 json_object_end(s);
898 return was_pending(command_raw_complete(p->cmd, s));
899 }
900 if (p->custom_error != NULL) {
901 struct json_stream *s = json_start(p->cmd);
902 json_add_jsonstr(s, "error",
903 p->custom_error, strlen(p->custom_error));
904 json_object_end(s);
905 return was_pending(command_raw_complete(p->cmd, s));
906 }
907 if (p->custom_replace != NULL)
908 return replace_command(p, p->custom_buffer, p->custom_replace);
909
910 /* If no plugin requested a change, just continue command execution. */
911 params = json_get_member(p->buffer, p->request, "params");
912 return was_pending(command_exec(p->cmd->jcon,
913 p->cmd,
914 p->buffer,
915 p->request,
916 params));
917}
918
919static bool
920rpc_command_hook_callback(struct rpc_command_hook_payload *p,

Callers 1

Calls 8

json_add_jsonstrFunction · 0.85
json_object_endFunction · 0.85
command_raw_completeFunction · 0.85
replace_commandFunction · 0.85
json_get_memberFunction · 0.85
command_execFunction · 0.85
json_startFunction · 0.70
was_pendingFunction · 0.70

Tested by

no test coverage detected