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

Function rpc_command_hook_final

lightningd/jsonrpc.c:741–772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

739}
740
741static void rpc_command_hook_final(struct rpc_command_hook_payload *p STEALS)
742{
743 const jsmntok_t *params;
744
745 /* Free payload with cmd */
746 tal_steal(p->cmd, p);
747
748 if (p->custom_result != NULL) {
749 struct json_stream *s = json_start(p->cmd);
750 json_add_jsonstr(s, "result",
751 p->custom_result, strlen(p->custom_result));
752 json_object_end(s);
753 return was_pending(command_raw_complete(p->cmd, s));
754 }
755 if (p->custom_error != NULL) {
756 struct json_stream *s = json_start(p->cmd);
757 json_add_jsonstr(s, "error",
758 p->custom_error, strlen(p->custom_error));
759 json_object_end(s);
760 return was_pending(command_raw_complete(p->cmd, s));
761 }
762 if (p->custom_replace != NULL)
763 return replace_command(p, p->custom_buffer, p->custom_replace);
764
765 /* If no plugin requested a change, just continue command execution. */
766 params = json_get_member(p->buffer, p->request, "params");
767 return was_pending(command_exec(p->cmd->jcon,
768 p->cmd,
769 p->buffer,
770 p->request,
771 params));
772}
773
774static bool
775rpc_command_hook_callback(struct rpc_command_hook_payload *p,

Callers 1

Calls 8

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

Tested by

no test coverage detected