| 739 | } |
| 740 | |
| 741 | static 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 | |
| 774 | static bool |
| 775 | rpc_command_hook_callback(struct rpc_command_hook_payload *p, |
no test coverage detected