mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
jsonrpc: register base on linkage.
Other than being neater (no more global list to edit!), this lets the new daemon and old daemon have their own separate routines. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
c7b69abdaa
commit
12b30ab4fc
@ -592,12 +592,13 @@ static void json_dev_broadcast(struct command *cmd,
|
|||||||
command_success(cmd, null_response(cmd));
|
command_success(cmd, null_response(cmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command dev_broadcast_command = {
|
static const struct json_command dev_broadcast_command = {
|
||||||
"dev-broadcast",
|
"dev-broadcast",
|
||||||
json_dev_broadcast,
|
json_dev_broadcast,
|
||||||
"Pretend we broadcast txs, but don't send to bitcoind",
|
"Pretend we broadcast txs, but don't send to bitcoind",
|
||||||
"Returns an empty result on success (waits for flush if enabled)"
|
"Returns an empty result on success (waits for flush if enabled)"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_broadcast_command);
|
||||||
|
|
||||||
void setup_topology(struct lightningd_state *dstate)
|
void setup_topology(struct lightningd_state *dstate)
|
||||||
{
|
{
|
||||||
|
@ -196,12 +196,13 @@ static void json_invoice(struct command *cmd,
|
|||||||
command_success(cmd, response);
|
command_success(cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command invoice_command = {
|
static const struct json_command invoice_command = {
|
||||||
"invoice",
|
"invoice",
|
||||||
json_invoice,
|
json_invoice,
|
||||||
"Create invoice for {msatoshi} with {label} (with a set {r}, otherwise generate one)",
|
"Create invoice for {msatoshi} with {label} (with a set {r}, otherwise generate one)",
|
||||||
"Returns the {rhash} on success. "
|
"Returns the {rhash} on success. "
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &invoice_command);
|
||||||
|
|
||||||
static void json_add_invoices(struct json_result *response,
|
static void json_add_invoices(struct json_result *response,
|
||||||
const struct list_head *list,
|
const struct list_head *list,
|
||||||
@ -246,12 +247,13 @@ static void json_listinvoice(struct command *cmd,
|
|||||||
command_success(cmd, response);
|
command_success(cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command listinvoice_command = {
|
static const struct json_command listinvoice_command = {
|
||||||
"listinvoice",
|
"listinvoice",
|
||||||
json_listinvoice,
|
json_listinvoice,
|
||||||
"Show invoice {label} (or all, if no {label}))",
|
"Show invoice {label} (or all, if no {label}))",
|
||||||
"Returns an array of {label}, {rhash}, {msatoshi} and {complete} on success. "
|
"Returns an array of {label}, {rhash}, {msatoshi} and {complete} on success. "
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &listinvoice_command);
|
||||||
|
|
||||||
static void json_delinvoice(struct command *cmd,
|
static void json_delinvoice(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -291,12 +293,13 @@ static void json_delinvoice(struct command *cmd,
|
|||||||
tal_free(i);
|
tal_free(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command delinvoice_command = {
|
static const struct json_command delinvoice_command = {
|
||||||
"delinvoice",
|
"delinvoice",
|
||||||
json_delinvoice,
|
json_delinvoice,
|
||||||
"Delete unpaid invoice {label}))",
|
"Delete unpaid invoice {label}))",
|
||||||
"Returns {label}, {rhash} and {msatoshi} on success. "
|
"Returns {label}, {rhash} and {msatoshi} on success. "
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &delinvoice_command);
|
||||||
|
|
||||||
static void json_waitinvoice(struct command *cmd,
|
static void json_waitinvoice(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -340,9 +343,10 @@ static void json_waitinvoice(struct command *cmd,
|
|||||||
list_add_tail(&invs->invoice_waiters, &w->list);
|
list_add_tail(&invs->invoice_waiters, &w->list);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command waitinvoice_command = {
|
static const struct json_command waitinvoice_command = {
|
||||||
"waitinvoice",
|
"waitinvoice",
|
||||||
json_waitinvoice,
|
json_waitinvoice,
|
||||||
"Wait for the next invoice to be paid, after {label} (if supplied)))",
|
"Wait for the next invoice to be paid, after {label} (if supplied)))",
|
||||||
"Returns {label}, {rhash} and {msatoshi} on success. "
|
"Returns {label}, {rhash} and {msatoshi} on success. "
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &waitinvoice_command);
|
||||||
|
@ -44,6 +44,7 @@ static const struct json_command help_command = {
|
|||||||
"describe commands",
|
"describe commands",
|
||||||
"[<command>] if specified gives details about a single command."
|
"[<command>] if specified gives details about a single command."
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &help_command);
|
||||||
|
|
||||||
static void json_stop(struct command *cmd,
|
static void json_stop(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -62,6 +63,7 @@ static const struct json_command stop_command = {
|
|||||||
"Shutdown the lightningd process",
|
"Shutdown the lightningd process",
|
||||||
"What part of shutdown wasn't clear?"
|
"What part of shutdown wasn't clear?"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &stop_command);
|
||||||
|
|
||||||
struct log_info {
|
struct log_info {
|
||||||
enum log_level level;
|
enum log_level level;
|
||||||
@ -174,6 +176,7 @@ static const struct json_command getlog_command = {
|
|||||||
"Get logs, with optional level: [io|debug|info|unusual]",
|
"Get logs, with optional level: [io|debug|info|unusual]",
|
||||||
"Returns log array"
|
"Returns log array"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &getlog_command);
|
||||||
|
|
||||||
static void json_rhash(struct command *cmd,
|
static void json_rhash(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -212,6 +215,7 @@ static const struct json_command dev_rhash_command = {
|
|||||||
"SHA256 of {secret}",
|
"SHA256 of {secret}",
|
||||||
"Returns a hash value"
|
"Returns a hash value"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_rhash_command);
|
||||||
|
|
||||||
static void json_crash(struct command *cmd,
|
static void json_crash(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -225,6 +229,7 @@ static const struct json_command dev_crash_command = {
|
|||||||
"Call fatal().",
|
"Call fatal().",
|
||||||
"Simple crash test for developers"
|
"Simple crash test for developers"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_crash_command);
|
||||||
|
|
||||||
static void json_restart(struct command *cmd,
|
static void json_restart(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -256,6 +261,7 @@ static const struct json_command dev_restart_command = {
|
|||||||
"Re-exec the given {binary}.",
|
"Re-exec the given {binary}.",
|
||||||
"Simple restart test for developers"
|
"Simple restart test for developers"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_restart_command);
|
||||||
|
|
||||||
static void json_getinfo(struct command *cmd,
|
static void json_getinfo(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -280,51 +286,28 @@ static const struct json_command getinfo_command = {
|
|||||||
"Get general information about this node",
|
"Get general information about this node",
|
||||||
"Returns {id}, {port}, {testnet}, etc."
|
"Returns {id}, {port}, {testnet}, etc."
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &getinfo_command);
|
||||||
|
|
||||||
static const struct json_command *cmdlist[] = {
|
static size_t num_cmdlist;
|
||||||
&help_command,
|
|
||||||
&stop_command,
|
static struct json_command **get_cmdlist(void)
|
||||||
&getlog_command,
|
{
|
||||||
&connect_command,
|
static struct json_command **cmdlist;
|
||||||
&getpeers_command,
|
if (!cmdlist)
|
||||||
&getnodes_command,
|
cmdlist = autodata_get(json_command, &num_cmdlist);
|
||||||
&gethtlcs_command,
|
|
||||||
&close_command,
|
return cmdlist;
|
||||||
&newaddr_command,
|
}
|
||||||
&invoice_command,
|
|
||||||
&listinvoice_command,
|
|
||||||
&delinvoice_command,
|
|
||||||
&waitinvoice_command,
|
|
||||||
&getchannels_command,
|
|
||||||
&getroute_command,
|
|
||||||
&sendpay_command,
|
|
||||||
&getinfo_command,
|
|
||||||
/* Developer/debugging options. */
|
|
||||||
&dev_newhtlc_command,
|
|
||||||
&dev_fulfillhtlc_command,
|
|
||||||
&dev_failhtlc_command,
|
|
||||||
&dev_commit_command,
|
|
||||||
&dev_feerate_command,
|
|
||||||
&dev_rhash_command,
|
|
||||||
&dev_crash_command,
|
|
||||||
&dev_restart_command,
|
|
||||||
&dev_disconnect_command,
|
|
||||||
&dev_reconnect_command,
|
|
||||||
&dev_signcommit_command,
|
|
||||||
&dev_output_command,
|
|
||||||
&dev_add_route_command,
|
|
||||||
&dev_routefail_command,
|
|
||||||
&dev_broadcast_command,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void json_help(struct command *cmd,
|
static void json_help(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct json_result *response = new_json_result(cmd);
|
struct json_result *response = new_json_result(cmd);
|
||||||
|
struct json_command **cmdlist = get_cmdlist();
|
||||||
|
|
||||||
json_array_start(response, NULL);
|
json_array_start(response, NULL);
|
||||||
for (i = 0; i < ARRAY_SIZE(cmdlist); i++) {
|
for (i = 0; i < num_cmdlist; i++) {
|
||||||
json_add_object(response,
|
json_add_object(response,
|
||||||
"command", JSMN_STRING,
|
"command", JSMN_STRING,
|
||||||
cmdlist[i]->name,
|
cmdlist[i]->name,
|
||||||
@ -340,9 +323,10 @@ static const struct json_command *find_cmd(const char *buffer,
|
|||||||
const jsmntok_t *tok)
|
const jsmntok_t *tok)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
struct json_command **cmdlist = get_cmdlist();
|
||||||
|
|
||||||
/* cmdlist[i]->name can be NULL in test code. */
|
/* cmdlist[i]->name can be NULL in test code. */
|
||||||
for (i = 0; i < ARRAY_SIZE(cmdlist); i++)
|
for (i = 0; i < num_cmdlist; i++)
|
||||||
if (cmdlist[i]->name
|
if (cmdlist[i]->name
|
||||||
&& json_tok_streq(buffer, tok, cmdlist[i]->name))
|
&& json_tok_streq(buffer, tok, cmdlist[i]->name))
|
||||||
return cmdlist[i];
|
return cmdlist[i];
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define LIGHTNING_DAEMON_JSONRPC_H
|
#define LIGHTNING_DAEMON_JSONRPC_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "json.h"
|
#include "json.h"
|
||||||
|
#include <ccan/autodata/autodata.h>
|
||||||
#include <ccan/list/list.h>
|
#include <ccan/list/list.h>
|
||||||
|
|
||||||
/* Context for a command (from JSON, but might outlive the connection!)
|
/* Context for a command (from JSON, but might outlive the connection!)
|
||||||
@ -56,38 +57,5 @@ void PRINTF_FMT(2, 3) command_fail(struct command *cmd, const char *fmt, ...);
|
|||||||
/* For initialization */
|
/* For initialization */
|
||||||
void setup_jsonrpc(struct lightningd_state *dstate, const char *rpc_filename);
|
void setup_jsonrpc(struct lightningd_state *dstate, const char *rpc_filename);
|
||||||
|
|
||||||
/* Peer management */
|
AUTODATA_TYPE(json_command, struct json_command);
|
||||||
extern const struct json_command newaddr_command;
|
|
||||||
extern const struct json_command connect_command;
|
|
||||||
extern const struct json_command close_command;
|
|
||||||
extern const struct json_command getchannels_command;
|
|
||||||
extern const struct json_command getpeers_command;
|
|
||||||
extern const struct json_command getnodes_command;
|
|
||||||
|
|
||||||
/* Invoice management. */
|
|
||||||
extern const struct json_command invoice_command;
|
|
||||||
extern const struct json_command listinvoice_command;
|
|
||||||
extern const struct json_command delinvoice_command;
|
|
||||||
extern const struct json_command waitinvoice_command;
|
|
||||||
|
|
||||||
/* Payment management. */
|
|
||||||
extern const struct json_command getroute_command;
|
|
||||||
extern const struct json_command sendpay_command;
|
|
||||||
|
|
||||||
/* Low-level commands. */
|
|
||||||
extern const struct json_command gethtlcs_command;
|
|
||||||
|
|
||||||
/* Developer commands. */
|
|
||||||
extern const struct json_command dev_add_route_command;
|
|
||||||
extern const struct json_command dev_newhtlc_command;
|
|
||||||
extern const struct json_command dev_fulfillhtlc_command;
|
|
||||||
extern const struct json_command dev_failhtlc_command;
|
|
||||||
extern const struct json_command dev_commit_command;
|
|
||||||
extern const struct json_command dev_reconnect_command;
|
|
||||||
extern const struct json_command dev_disconnect_command;
|
|
||||||
extern const struct json_command dev_signcommit_command;
|
|
||||||
extern const struct json_command dev_output_command;
|
|
||||||
extern const struct json_command dev_routefail_command;
|
|
||||||
extern const struct json_command dev_feerate_command;
|
|
||||||
extern const struct json_command dev_broadcast_command;
|
|
||||||
#endif /* LIGHTNING_DAEMON_JSONRPC_H */
|
#endif /* LIGHTNING_DAEMON_JSONRPC_H */
|
||||||
|
@ -281,12 +281,13 @@ static void json_getroute(struct command *cmd,
|
|||||||
command_success(cmd, response);
|
command_success(cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command getroute_command = {
|
static const struct json_command getroute_command = {
|
||||||
"getroute",
|
"getroute",
|
||||||
json_getroute,
|
json_getroute,
|
||||||
"Return route to {id} for {msatoshi}, using {riskfactor}",
|
"Return route to {id} for {msatoshi}, using {riskfactor}",
|
||||||
"Returns a {route} array of {id} {msatoshi} {delay}: msatoshi and delay (in blocks) is cumulative."
|
"Returns a {route} array of {id} {msatoshi} {delay}: msatoshi and delay (in blocks) is cumulative."
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &getroute_command);
|
||||||
|
|
||||||
static void json_sendpay(struct command *cmd,
|
static void json_sendpay(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -494,9 +495,10 @@ static void json_sendpay(struct command *cmd,
|
|||||||
tal_add_destructor(cmd, remove_cmd_from_pc);
|
tal_add_destructor(cmd, remove_cmd_from_pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command sendpay_command = {
|
static const struct json_command sendpay_command = {
|
||||||
"sendpay",
|
"sendpay",
|
||||||
json_sendpay,
|
json_sendpay,
|
||||||
"Send along {route} in return for preimage of {rhash}",
|
"Send along {route} in return for preimage of {rhash}",
|
||||||
"Returns the {preimage} on success"
|
"Returns the {preimage} on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &sendpay_command);
|
||||||
|
@ -3225,12 +3225,13 @@ static void json_connect(struct command *cmd,
|
|||||||
tal_free(tmpctx);
|
tal_free(tmpctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command connect_command = {
|
static const struct json_command connect_command = {
|
||||||
"connect",
|
"connect",
|
||||||
json_connect,
|
json_connect,
|
||||||
"Connect to a {host} at {port} using hex-encoded {tx} to fund",
|
"Connect to a {host} at {port} using hex-encoded {tx} to fund",
|
||||||
"Returns the {id} on success (once channel established)"
|
"Returns the {id} on success (once channel established)"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &connect_command);
|
||||||
|
|
||||||
/* Have any of our HTLCs passed their deadline? */
|
/* Have any of our HTLCs passed their deadline? */
|
||||||
static bool any_deadline_past(struct peer *peer)
|
static bool any_deadline_past(struct peer *peer)
|
||||||
@ -4568,12 +4569,13 @@ static void json_getpeers(struct command *cmd,
|
|||||||
command_success(cmd, response);
|
command_success(cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command getpeers_command = {
|
static const struct json_command getpeers_command = {
|
||||||
"getpeers",
|
"getpeers",
|
||||||
json_getpeers,
|
json_getpeers,
|
||||||
"List the current peers",
|
"List the current peers",
|
||||||
"Returns a 'peers' array"
|
"Returns a 'peers' array"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &getpeers_command);
|
||||||
|
|
||||||
static void json_gethtlcs(struct command *cmd,
|
static void json_gethtlcs(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -4640,12 +4642,13 @@ static void json_gethtlcs(struct command *cmd,
|
|||||||
command_success(cmd, response);
|
command_success(cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command gethtlcs_command = {
|
static const struct json_command gethtlcs_command = {
|
||||||
"gethtlcs",
|
"gethtlcs",
|
||||||
json_gethtlcs,
|
json_gethtlcs,
|
||||||
"List HTLCs for {peer}; all if {resolved} is true.",
|
"List HTLCs for {peer}; all if {resolved} is true.",
|
||||||
"Returns a 'htlcs' array"
|
"Returns a 'htlcs' array"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &gethtlcs_command);
|
||||||
|
|
||||||
/* To avoid freeing underneath ourselves, we free outside event loop. */
|
/* To avoid freeing underneath ourselves, we free outside event loop. */
|
||||||
void cleanup_peers(struct lightningd_state *dstate)
|
void cleanup_peers(struct lightningd_state *dstate)
|
||||||
@ -4751,12 +4754,13 @@ static void json_newhtlc(struct command *cmd,
|
|||||||
command_success(cmd, response);
|
command_success(cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command dev_newhtlc_command = {
|
static const struct json_command dev_newhtlc_command = {
|
||||||
"dev-newhtlc",
|
"dev-newhtlc",
|
||||||
json_newhtlc,
|
json_newhtlc,
|
||||||
"Offer {peerid} an HTLC worth {msatoshi} in {expiry} (block number) with {rhash}",
|
"Offer {peerid} an HTLC worth {msatoshi} in {expiry} (block number) with {rhash}",
|
||||||
"Returns { id: u64 } result on success"
|
"Returns { id: u64 } result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_newhtlc_command);
|
||||||
|
|
||||||
static void json_fulfillhtlc(struct command *cmd,
|
static void json_fulfillhtlc(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -4852,12 +4856,13 @@ static void json_fulfillhtlc(struct command *cmd,
|
|||||||
state_name(peer->state));
|
state_name(peer->state));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command dev_fulfillhtlc_command = {
|
static const struct json_command dev_fulfillhtlc_command = {
|
||||||
"dev-fulfillhtlc",
|
"dev-fulfillhtlc",
|
||||||
json_fulfillhtlc,
|
json_fulfillhtlc,
|
||||||
"Redeem htlc proposed by {peerid} of {id} using {r}",
|
"Redeem htlc proposed by {peerid} of {id} using {r}",
|
||||||
"Returns an empty result on success"
|
"Returns an empty result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_fulfillhtlc_command);
|
||||||
|
|
||||||
static void json_failhtlc(struct command *cmd,
|
static void json_failhtlc(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -4931,12 +4936,13 @@ static void json_failhtlc(struct command *cmd,
|
|||||||
state_name(peer->state));
|
state_name(peer->state));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command dev_failhtlc_command = {
|
static const struct json_command dev_failhtlc_command = {
|
||||||
"dev-failhtlc",
|
"dev-failhtlc",
|
||||||
json_failhtlc,
|
json_failhtlc,
|
||||||
"Fail htlc proposed by {peerid} which has {id}, using {reason}",
|
"Fail htlc proposed by {peerid} which has {id}, using {reason}",
|
||||||
"Returns an empty result on success"
|
"Returns an empty result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_failhtlc_command);
|
||||||
|
|
||||||
static void json_commit(struct command *cmd,
|
static void json_commit(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -4975,12 +4981,13 @@ static void json_commit(struct command *cmd,
|
|||||||
do_commit(peer, cmd);
|
do_commit(peer, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command dev_commit_command = {
|
static const struct json_command dev_commit_command = {
|
||||||
"dev-commit",
|
"dev-commit",
|
||||||
json_commit,
|
json_commit,
|
||||||
"Commit all staged HTLC changes with {peerid}",
|
"Commit all staged HTLC changes with {peerid}",
|
||||||
"Returns an empty result on success"
|
"Returns an empty result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_commit_command);
|
||||||
|
|
||||||
static void json_close(struct command *cmd,
|
static void json_close(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -5015,12 +5022,13 @@ static void json_close(struct command *cmd,
|
|||||||
command_success(cmd, null_response(cmd));
|
command_success(cmd, null_response(cmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command close_command = {
|
static const struct json_command close_command = {
|
||||||
"close",
|
"close",
|
||||||
json_close,
|
json_close,
|
||||||
"Close the channel with peer {peerid}",
|
"Close the channel with peer {peerid}",
|
||||||
"Returns an empty result on success"
|
"Returns an empty result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &close_command);
|
||||||
|
|
||||||
static void json_feerate(struct command *cmd,
|
static void json_feerate(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -5045,12 +5053,13 @@ static void json_feerate(struct command *cmd,
|
|||||||
command_success(cmd, null_response(cmd));
|
command_success(cmd, null_response(cmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command dev_feerate_command = {
|
static const struct json_command dev_feerate_command = {
|
||||||
"dev-feerate",
|
"dev-feerate",
|
||||||
json_feerate,
|
json_feerate,
|
||||||
"Change the (default) fee rate to {feerate}",
|
"Change the (default) fee rate to {feerate}",
|
||||||
"Returns an empty result on success"
|
"Returns an empty result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_feerate_command);
|
||||||
|
|
||||||
static void json_disconnect(struct command *cmd,
|
static void json_disconnect(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -5196,30 +5205,34 @@ static void json_output(struct command *cmd,
|
|||||||
|
|
||||||
command_success(cmd, null_response(cmd));
|
command_success(cmd, null_response(cmd));
|
||||||
}
|
}
|
||||||
const struct json_command dev_output_command = {
|
static const struct json_command dev_output_command = {
|
||||||
"dev-output",
|
"dev-output",
|
||||||
json_output,
|
json_output,
|
||||||
"Enable/disable any messages to peer {peerid} depending on {enable}",
|
"Enable/disable any messages to peer {peerid} depending on {enable}",
|
||||||
"Returns an empty result on success"
|
"Returns an empty result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_output_command);
|
||||||
|
|
||||||
const struct json_command dev_disconnect_command = {
|
static const struct json_command dev_disconnect_command = {
|
||||||
"dev-disconnect",
|
"dev-disconnect",
|
||||||
json_disconnect,
|
json_disconnect,
|
||||||
"Force a disconnect with peer {peerid}",
|
"Force a disconnect with peer {peerid}",
|
||||||
"Returns an empty result on success"
|
"Returns an empty result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_disconnect_command);
|
||||||
|
|
||||||
const struct json_command dev_reconnect_command = {
|
static const struct json_command dev_reconnect_command = {
|
||||||
"dev-reconnect",
|
"dev-reconnect",
|
||||||
json_reconnect,
|
json_reconnect,
|
||||||
"Force a reconnect with peer {peerid}",
|
"Force a reconnect with peer {peerid}",
|
||||||
"Returns an empty result on success"
|
"Returns an empty result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_reconnect_command);
|
||||||
|
|
||||||
const struct json_command dev_signcommit_command = {
|
static const struct json_command dev_signcommit_command = {
|
||||||
"dev-signcommit",
|
"dev-signcommit",
|
||||||
json_signcommit,
|
json_signcommit,
|
||||||
"Sign and return the current commit with peer {peerid}",
|
"Sign and return the current commit with peer {peerid}",
|
||||||
"Returns a hex string on success"
|
"Returns a hex string on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_signcommit_command);
|
||||||
|
@ -574,12 +574,13 @@ void sync_routing_table(struct lightningd_state *dstate, struct peer *peer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command dev_add_route_command = {
|
static const struct json_command dev_add_route_command = {
|
||||||
"dev-add-route",
|
"dev-add-route",
|
||||||
json_add_route,
|
json_add_route,
|
||||||
"Add route from {src} to {dst}, {base} rate in msatoshi, {var} rate in msatoshi, {delay} blocks delay and {minblocks} minimum timeout",
|
"Add route from {src} to {dst}, {base} rate in msatoshi, {var} rate in msatoshi, {delay} blocks delay and {minblocks} minimum timeout",
|
||||||
"Returns an empty result on success"
|
"Returns an empty result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_add_route_command);
|
||||||
|
|
||||||
static void json_getchannels(struct command *cmd,
|
static void json_getchannels(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -612,12 +613,13 @@ static void json_getchannels(struct command *cmd,
|
|||||||
command_success(cmd, response);
|
command_success(cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command getchannels_command = {
|
static const struct json_command getchannels_command = {
|
||||||
"getchannels",
|
"getchannels",
|
||||||
json_getchannels,
|
json_getchannels,
|
||||||
"List all known channels.",
|
"List all known channels.",
|
||||||
"Returns a 'channels' array with all known channels including their fees."
|
"Returns a 'channels' array with all known channels including their fees."
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &getchannels_command);
|
||||||
|
|
||||||
static void json_routefail(struct command *cmd,
|
static void json_routefail(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -643,12 +645,13 @@ static void json_routefail(struct command *cmd,
|
|||||||
|
|
||||||
command_success(cmd, null_response(cmd));
|
command_success(cmd, null_response(cmd));
|
||||||
}
|
}
|
||||||
const struct json_command dev_routefail_command = {
|
static const struct json_command dev_routefail_command = {
|
||||||
"dev-routefail",
|
"dev-routefail",
|
||||||
json_routefail,
|
json_routefail,
|
||||||
"FAIL htlcs that we can't route if {enable}",
|
"FAIL htlcs that we can't route if {enable}",
|
||||||
"Returns an empty result on success"
|
"Returns an empty result on success"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &dev_routefail_command);
|
||||||
|
|
||||||
static void json_getnodes(struct command *cmd,
|
static void json_getnodes(struct command *cmd,
|
||||||
const char *buffer, const jsmntok_t *params)
|
const char *buffer, const jsmntok_t *params)
|
||||||
@ -680,9 +683,10 @@ static void json_getnodes(struct command *cmd,
|
|||||||
command_success(cmd, response);
|
command_success(cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command getnodes_command = {
|
static const struct json_command getnodes_command = {
|
||||||
"getnodes",
|
"getnodes",
|
||||||
json_getnodes,
|
json_getnodes,
|
||||||
"List all known nodes in the network.",
|
"List all known nodes in the network.",
|
||||||
"Returns a 'nodes' array"
|
"Returns a 'nodes' array"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &getnodes_command);
|
||||||
|
@ -135,9 +135,10 @@ static void json_newaddr(struct command *cmd,
|
|||||||
command_success(cmd, response);
|
command_success(cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct json_command newaddr_command = {
|
static const struct json_command newaddr_command = {
|
||||||
"newaddr",
|
"newaddr",
|
||||||
json_newaddr,
|
json_newaddr,
|
||||||
"Get a new address to fund a channel",
|
"Get a new address to fund a channel",
|
||||||
"Returns {address} a p2sh address"
|
"Returns {address} a p2sh address"
|
||||||
};
|
};
|
||||||
|
AUTODATA(json_command, &newaddr_command);
|
||||||
|
Loading…
Reference in New Issue
Block a user