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

Function rpc_command_hook_final

lightningd/jsonrpc.c:890–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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