| 1738 | } |
| 1739 | |
| 1740 | static struct command_result *json_rawrequest(struct command *cmd, |
| 1741 | const char *buffer, |
| 1742 | const jsmntok_t *params) |
| 1743 | { |
| 1744 | struct sent *sent = tal(cmd, struct sent); |
| 1745 | u32 *timeout; |
| 1746 | struct node_id *node_id; |
| 1747 | struct point32 node_id32; |
| 1748 | enum nodeid_parity parity; |
| 1749 | |
| 1750 | if (!param(cmd, buffer, params, |
| 1751 | p_req("invreq", param_invreq, &sent->invreq), |
| 1752 | p_req("nodeid", param_node_id, &node_id), |
| 1753 | p_opt_def("timeout", param_number, &timeout, 60), |
| 1754 | NULL)) |
| 1755 | return command_param_failed(); |
| 1756 | |
| 1757 | /* Skip over 02/03 in node_id */ |
| 1758 | if (!secp256k1_xonly_pubkey_parse(secp256k1_ctx, |
| 1759 | &node_id32.pubkey, |
| 1760 | node_id->k + 1)) |
| 1761 | return command_fail(cmd, JSONRPC2_INVALID_PARAMS, |
| 1762 | "Invalid nodeid"); |
| 1763 | /* This is how long we'll wait for a reply for. */ |
| 1764 | sent->wait_timeout = *timeout; |
| 1765 | sent->cmd = cmd; |
| 1766 | sent->offer = NULL; |
| 1767 | |
| 1768 | sent->path = path_to_node(sent, cmd->plugin, |
| 1769 | &node_id32, |
| 1770 | &parity); |
| 1771 | if (!sent->path) { |
| 1772 | /* We *do* know parity: they gave it to us! */ |
| 1773 | parity = node_id->k[0]; |
| 1774 | return connect_direct(cmd, &node_id32, parity, |
| 1775 | sendinvreq_after_connect, sent); |
| 1776 | } |
| 1777 | |
| 1778 | return sendinvreq_after_connect(cmd, NULL, NULL, sent); |
| 1779 | } |
| 1780 | #endif /* DEVELOPER */ |
| 1781 | |
| 1782 | static const struct plugin_command commands[] = { |
nothing calls this directly
no test coverage detected