mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
Rename struct json_result
to struct json_stream
(RENAMEONLY)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
66dcba099d
commit
0dcd66880c
@ -466,7 +466,7 @@ static void json_feerates(struct command *cmd,
|
||||
const char *buffer, const jsmntok_t *params)
|
||||
{
|
||||
struct chain_topology *topo = cmd->ld->topology;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
u32 feerates[NUM_FEERATES];
|
||||
bool missing;
|
||||
enum feerate_style *style;
|
||||
|
@ -65,7 +65,7 @@ static struct connect *find_connect(struct lightningd *ld,
|
||||
|
||||
static void connect_cmd_succeed(struct command *cmd, const struct pubkey *id)
|
||||
{
|
||||
struct json_result *response = json_stream_success(cmd);
|
||||
struct json_stream *response = json_stream_success(cmd);
|
||||
json_object_start(response, NULL);
|
||||
json_add_pubkey(response, "id", id);
|
||||
json_object_end(response);
|
||||
|
@ -178,7 +178,7 @@ void gossipd_notify_spend(struct lightningd *ld,
|
||||
}
|
||||
|
||||
/* Gossipd shouldn't give us bad pubkeys, but don't abort if they do */
|
||||
static void json_add_raw_pubkey(struct json_result *response,
|
||||
static void json_add_raw_pubkey(struct json_stream *response,
|
||||
const char *fieldname,
|
||||
const u8 raw_pubkey[sizeof(struct pubkey)])
|
||||
{
|
||||
@ -200,7 +200,7 @@ static void json_getnodes_reply(struct subd *gossip UNUSED, const u8 *reply,
|
||||
struct command *cmd)
|
||||
{
|
||||
struct gossip_getnodes_entry **nodes;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
size_t i, j;
|
||||
|
||||
if (!fromwire_gossip_getnodes_reply(reply, reply, &nodes)) {
|
||||
@ -273,7 +273,7 @@ AUTODATA(json_command, &listnodes_command);
|
||||
static void json_getroute_reply(struct subd *gossip UNUSED, const u8 *reply, const int *fds UNUSED,
|
||||
struct command *cmd)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct route_hop *hops;
|
||||
|
||||
fromwire_gossip_getroute_reply(reply, reply, &hops);
|
||||
@ -355,7 +355,7 @@ static void json_listchannels_reply(struct subd *gossip UNUSED, const u8 *reply,
|
||||
{
|
||||
size_t i;
|
||||
struct gossip_getchannels_entry *entries;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
|
||||
if (!fromwire_gossip_getchannels_reply(reply, reply, &entries)) {
|
||||
command_fail(cmd, LIGHTNINGD, "Invalid reply from gossipd");
|
||||
@ -425,7 +425,7 @@ static void json_scids_reply(struct subd *gossip UNUSED, const u8 *reply,
|
||||
const int *fds UNUSED, struct command *cmd)
|
||||
{
|
||||
bool ok, complete;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
|
||||
if (!fromwire_gossip_scids_reply(reply, &ok, &complete)) {
|
||||
command_fail(cmd, LIGHTNINGD,
|
||||
@ -521,7 +521,7 @@ AUTODATA(json_command, &dev_send_timestamp_filter);
|
||||
static void json_channel_range_reply(struct subd *gossip UNUSED, const u8 *reply,
|
||||
const int *fds UNUSED, struct command *cmd)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
u32 final_first_block, final_num_blocks;
|
||||
bool final_complete;
|
||||
struct short_channel_id *scids;
|
||||
|
@ -37,7 +37,7 @@ static const char *invoice_status_str(const struct invoice_details *inv)
|
||||
return "unpaid";
|
||||
}
|
||||
|
||||
static void json_add_invoice(struct json_result *response,
|
||||
static void json_add_invoice(struct json_stream *response,
|
||||
const struct invoice_details *inv)
|
||||
{
|
||||
json_object_start(response, NULL);
|
||||
@ -64,7 +64,7 @@ static void json_add_invoice(struct json_result *response,
|
||||
|
||||
static void tell_waiter(struct command *cmd, const struct invoice *inv)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
const struct invoice_details *details;
|
||||
|
||||
details = wallet_invoice_details(cmd, cmd->ld->wallet, *inv);
|
||||
@ -213,7 +213,7 @@ static void gossipd_incoming_channels_reply(struct subd *gossipd,
|
||||
const int *fs,
|
||||
struct invoice_info *info)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct route_info *inchans;
|
||||
bool any_offline;
|
||||
struct invoice invoice;
|
||||
@ -390,7 +390,7 @@ static const struct json_command invoice_command = {
|
||||
"(default autogenerated)"};
|
||||
AUTODATA(json_command, &invoice_command);
|
||||
|
||||
static void json_add_invoices(struct json_result *response,
|
||||
static void json_add_invoices(struct json_stream *response,
|
||||
struct wallet *wallet,
|
||||
const struct json_escaped *label)
|
||||
{
|
||||
@ -418,7 +418,7 @@ static void json_listinvoices(struct command *cmd,
|
||||
const char *buffer, const jsmntok_t *params)
|
||||
{
|
||||
struct json_escaped *label;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct wallet *wallet = cmd->ld->wallet;
|
||||
if (!param(cmd, buffer, params,
|
||||
p_opt("label", json_tok_label, &label),
|
||||
@ -445,7 +445,7 @@ static void json_delinvoice(struct command *cmd,
|
||||
{
|
||||
struct invoice i;
|
||||
const struct invoice_details *details;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
const char *status, *actual_status;
|
||||
struct json_escaped *label;
|
||||
struct wallet *wallet = cmd->ld->wallet;
|
||||
@ -612,7 +612,7 @@ static const struct json_command waitinvoice_command = {
|
||||
};
|
||||
AUTODATA(json_command, &waitinvoice_command);
|
||||
|
||||
static void json_add_fallback(struct json_result *response,
|
||||
static void json_add_fallback(struct json_stream *response,
|
||||
const char *fieldname,
|
||||
const u8 *fallback,
|
||||
const struct chainparams *chain)
|
||||
@ -651,7 +651,7 @@ static void json_decodepay(struct command *cmd,
|
||||
const char *buffer, const jsmntok_t *params)
|
||||
{
|
||||
struct bolt11 *b11;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
const char *str, *desc;
|
||||
char *fail;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
/* Output a route hop */
|
||||
static void
|
||||
json_add_route_hop(struct json_result *r, char const *n,
|
||||
json_add_route_hop(struct json_stream *r, char const *n,
|
||||
const struct route_hop *h)
|
||||
{
|
||||
/* Imitate what getroute/sendpay use */
|
||||
@ -33,7 +33,7 @@ json_add_route_hop(struct json_result *r, char const *n,
|
||||
|
||||
/* Output a route */
|
||||
void
|
||||
json_add_route(struct json_result *r, char const *n,
|
||||
json_add_route(struct json_stream *r, char const *n,
|
||||
const struct route_hop *hops, size_t hops_len)
|
||||
{
|
||||
size_t i;
|
||||
@ -46,7 +46,7 @@ json_add_route(struct json_result *r, char const *n,
|
||||
|
||||
/* Outputs fields, not a separate object*/
|
||||
void
|
||||
json_add_payment_fields(struct json_result *response,
|
||||
json_add_payment_fields(struct json_stream *response,
|
||||
const struct wallet_payment *t)
|
||||
{
|
||||
json_add_u64(response, "id", t->id);
|
||||
@ -75,7 +75,7 @@ json_add_payment_fields(struct json_result *response,
|
||||
json_add_string(response, "description", t->description);
|
||||
}
|
||||
|
||||
void json_add_pubkey(struct json_result *response,
|
||||
void json_add_pubkey(struct json_stream *response,
|
||||
const char *fieldname,
|
||||
const struct pubkey *key)
|
||||
{
|
||||
@ -85,7 +85,7 @@ void json_add_pubkey(struct json_result *response,
|
||||
json_add_hex(response, fieldname, der, sizeof(der));
|
||||
}
|
||||
|
||||
void json_add_txid(struct json_result *result, const char *fieldname,
|
||||
void json_add_txid(struct json_stream *result, const char *fieldname,
|
||||
const struct bitcoin_txid *txid)
|
||||
{
|
||||
char hex[hex_str_size(sizeof(*txid))];
|
||||
@ -284,7 +284,7 @@ bool json_tok_pubkey(struct command *cmd, const char *name,
|
||||
return false;
|
||||
}
|
||||
|
||||
void json_add_short_channel_id(struct json_result *response,
|
||||
void json_add_short_channel_id(struct json_stream *response,
|
||||
const char *fieldname,
|
||||
const struct short_channel_id *id)
|
||||
{
|
||||
@ -405,7 +405,7 @@ json_tok_channel_id(const char *buffer, const jsmntok_t *tok,
|
||||
cid, sizeof(*cid));
|
||||
}
|
||||
|
||||
void json_add_address(struct json_result *response, const char *fieldname,
|
||||
void json_add_address(struct json_stream *response, const char *fieldname,
|
||||
const struct wireaddr *addr)
|
||||
{
|
||||
/* No need to print padding */
|
||||
@ -436,7 +436,7 @@ void json_add_address(struct json_result *response, const char *fieldname,
|
||||
json_object_end(response);
|
||||
}
|
||||
|
||||
void json_add_address_internal(struct json_result *response,
|
||||
void json_add_address_internal(struct json_stream *response,
|
||||
const char *fieldname,
|
||||
const struct wireaddr_internal *addr)
|
||||
{
|
||||
@ -480,7 +480,7 @@ bool json_tok_tok(struct command *cmd, const char *name,
|
||||
return (*out = tok);
|
||||
}
|
||||
|
||||
struct json_result {
|
||||
struct json_stream {
|
||||
#if DEVELOPER
|
||||
/* tal_arr of types (JSMN_OBJECT/JSMN_ARRAY) we're enclosed in. */
|
||||
jsmntype_t *wrapping;
|
||||
@ -495,7 +495,7 @@ struct json_result {
|
||||
struct command *cmd;
|
||||
};
|
||||
|
||||
static void result_append(struct json_result *res, const char *str)
|
||||
static void result_append(struct json_stream *res, const char *str)
|
||||
{
|
||||
struct json_connection *jcon = res->cmd->jcon;
|
||||
|
||||
@ -507,7 +507,7 @@ static void result_append(struct json_result *res, const char *str)
|
||||
}
|
||||
|
||||
static void PRINTF_FMT(2,3)
|
||||
result_append_fmt(struct json_result *res, const char *fmt, ...)
|
||||
result_append_fmt(struct json_stream *res, const char *fmt, ...)
|
||||
{
|
||||
struct json_connection *jcon = res->cmd->jcon;
|
||||
va_list ap;
|
||||
@ -521,7 +521,7 @@ result_append_fmt(struct json_result *res, const char *fmt, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void check_fieldname(const struct json_result *result,
|
||||
static void check_fieldname(const struct json_stream *result,
|
||||
const char *fieldname)
|
||||
{
|
||||
#if DEVELOPER
|
||||
@ -538,7 +538,7 @@ static void check_fieldname(const struct json_result *result,
|
||||
#endif
|
||||
}
|
||||
|
||||
static void result_append_indent(struct json_result *result)
|
||||
static void result_append_indent(struct json_stream *result)
|
||||
{
|
||||
static const char indent_buf[] = " ";
|
||||
size_t len;
|
||||
@ -552,7 +552,7 @@ static void result_append_indent(struct json_result *result)
|
||||
}
|
||||
}
|
||||
|
||||
static void json_start_member(struct json_result *result, const char *fieldname)
|
||||
static void json_start_member(struct json_stream *result, const char *fieldname)
|
||||
{
|
||||
/* Prepend comma if required. */
|
||||
if (!result->empty)
|
||||
@ -568,7 +568,7 @@ static void json_start_member(struct json_result *result, const char *fieldname)
|
||||
result->empty = false;
|
||||
}
|
||||
|
||||
static void result_indent(struct json_result *result, jsmntype_t type)
|
||||
static void result_indent(struct json_stream *result, jsmntype_t type)
|
||||
{
|
||||
#if DEVELOPER
|
||||
*tal_arr_expand(&result->wrapping) = type;
|
||||
@ -577,7 +577,7 @@ static void result_indent(struct json_result *result, jsmntype_t type)
|
||||
result->indent++;
|
||||
}
|
||||
|
||||
static void result_unindent(struct json_result *result, jsmntype_t type)
|
||||
static void result_unindent(struct json_stream *result, jsmntype_t type)
|
||||
{
|
||||
assert(result->indent);
|
||||
#if DEVELOPER
|
||||
@ -589,14 +589,14 @@ static void result_unindent(struct json_result *result, jsmntype_t type)
|
||||
result->indent--;
|
||||
}
|
||||
|
||||
void json_array_start(struct json_result *result, const char *fieldname)
|
||||
void json_array_start(struct json_stream *result, const char *fieldname)
|
||||
{
|
||||
json_start_member(result, fieldname);
|
||||
result_append(result, "[");
|
||||
result_indent(result, JSMN_ARRAY);
|
||||
}
|
||||
|
||||
void json_array_end(struct json_result *result)
|
||||
void json_array_end(struct json_stream *result)
|
||||
{
|
||||
result_append(result, "\n");
|
||||
result_unindent(result, JSMN_ARRAY);
|
||||
@ -604,14 +604,14 @@ void json_array_end(struct json_result *result)
|
||||
result_append(result, "]");
|
||||
}
|
||||
|
||||
void json_object_start(struct json_result *result, const char *fieldname)
|
||||
void json_object_start(struct json_stream *result, const char *fieldname)
|
||||
{
|
||||
json_start_member(result, fieldname);
|
||||
result_append(result, "{");
|
||||
result_indent(result, JSMN_OBJECT);
|
||||
}
|
||||
|
||||
void json_object_end(struct json_result *result)
|
||||
void json_object_end(struct json_stream *result)
|
||||
{
|
||||
result_append(result, "\n");
|
||||
result_unindent(result, JSMN_OBJECT);
|
||||
@ -619,33 +619,33 @@ void json_object_end(struct json_result *result)
|
||||
result_append(result, "}");
|
||||
}
|
||||
|
||||
void json_add_num(struct json_result *result, const char *fieldname, unsigned int value)
|
||||
void json_add_num(struct json_stream *result, const char *fieldname, unsigned int value)
|
||||
{
|
||||
json_start_member(result, fieldname);
|
||||
result_append_fmt(result, "%u", value);
|
||||
}
|
||||
|
||||
void json_add_double(struct json_result *result, const char *fieldname, double value)
|
||||
void json_add_double(struct json_stream *result, const char *fieldname, double value)
|
||||
{
|
||||
json_start_member(result, fieldname);
|
||||
result_append_fmt(result, "%f", value);
|
||||
}
|
||||
|
||||
void json_add_u64(struct json_result *result, const char *fieldname,
|
||||
void json_add_u64(struct json_stream *result, const char *fieldname,
|
||||
uint64_t value)
|
||||
{
|
||||
json_start_member(result, fieldname);
|
||||
result_append_fmt(result, "%"PRIu64, value);
|
||||
}
|
||||
|
||||
void json_add_literal(struct json_result *result, const char *fieldname,
|
||||
void json_add_literal(struct json_stream *result, const char *fieldname,
|
||||
const char *literal, int len)
|
||||
{
|
||||
json_start_member(result, fieldname);
|
||||
result_append_fmt(result, "%.*s", len, literal);
|
||||
}
|
||||
|
||||
void json_add_string(struct json_result *result, const char *fieldname, const char *value)
|
||||
void json_add_string(struct json_stream *result, const char *fieldname, const char *value)
|
||||
{
|
||||
struct json_escaped *esc = json_partial_escape(NULL, value);
|
||||
|
||||
@ -654,13 +654,13 @@ void json_add_string(struct json_result *result, const char *fieldname, const ch
|
||||
tal_free(esc);
|
||||
}
|
||||
|
||||
void json_add_bool(struct json_result *result, const char *fieldname, bool value)
|
||||
void json_add_bool(struct json_stream *result, const char *fieldname, bool value)
|
||||
{
|
||||
json_start_member(result, fieldname);
|
||||
result_append(result, value ? "true" : "false");
|
||||
}
|
||||
|
||||
void json_add_hex(struct json_result *result, const char *fieldname,
|
||||
void json_add_hex(struct json_stream *result, const char *fieldname,
|
||||
const void *data, size_t len)
|
||||
{
|
||||
char *hex = tal_arr(NULL, char, hex_str_size(len));
|
||||
@ -670,14 +670,14 @@ void json_add_hex(struct json_result *result, const char *fieldname,
|
||||
tal_free(hex);
|
||||
}
|
||||
|
||||
void json_add_hex_talarr(struct json_result *result,
|
||||
void json_add_hex_talarr(struct json_stream *result,
|
||||
const char *fieldname,
|
||||
const tal_t *data)
|
||||
{
|
||||
json_add_hex(result, fieldname, data, tal_bytelen(data));
|
||||
}
|
||||
|
||||
void json_add_object(struct json_result *result, ...)
|
||||
void json_add_object(struct json_stream *result, ...)
|
||||
{
|
||||
va_list ap;
|
||||
const char *field;
|
||||
@ -696,7 +696,7 @@ void json_add_object(struct json_result *result, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void json_add_escaped_string(struct json_result *result, const char *fieldname,
|
||||
void json_add_escaped_string(struct json_stream *result, const char *fieldname,
|
||||
const struct json_escaped *esc TAKES)
|
||||
{
|
||||
json_start_member(result, fieldname);
|
||||
@ -705,9 +705,9 @@ void json_add_escaped_string(struct json_result *result, const char *fieldname,
|
||||
tal_free(esc);
|
||||
}
|
||||
|
||||
static struct json_result *new_json_stream(struct command *cmd)
|
||||
static struct json_stream *new_json_stream(struct command *cmd)
|
||||
{
|
||||
struct json_result *r = tal(cmd, struct json_result);
|
||||
struct json_stream *r = tal(cmd, struct json_stream);
|
||||
|
||||
r->cmd = cmd;
|
||||
#if DEVELOPER
|
||||
@ -721,19 +721,19 @@ static struct json_result *new_json_stream(struct command *cmd)
|
||||
return r;
|
||||
}
|
||||
|
||||
struct json_result *json_stream_success(struct command *cmd)
|
||||
struct json_stream *json_stream_success(struct command *cmd)
|
||||
{
|
||||
struct json_result *r;
|
||||
struct json_stream *r;
|
||||
r = new_json_stream(cmd);
|
||||
result_append(r, "\"result\" : ");
|
||||
return r;
|
||||
}
|
||||
|
||||
struct json_result *json_stream_fail_nodata(struct command *cmd,
|
||||
struct json_stream *json_stream_fail_nodata(struct command *cmd,
|
||||
int code,
|
||||
const char *errmsg)
|
||||
{
|
||||
struct json_result *r = new_json_stream(cmd);
|
||||
struct json_stream *r = new_json_stream(cmd);
|
||||
|
||||
assert(code);
|
||||
assert(errmsg);
|
||||
@ -744,11 +744,11 @@ struct json_result *json_stream_fail_nodata(struct command *cmd,
|
||||
return r;
|
||||
}
|
||||
|
||||
struct json_result *json_stream_fail(struct command *cmd,
|
||||
struct json_stream *json_stream_fail(struct command *cmd,
|
||||
int code,
|
||||
const char *errmsg)
|
||||
{
|
||||
struct json_result *r = json_stream_fail_nodata(cmd, code, errmsg);
|
||||
struct json_stream *r = json_stream_fail_nodata(cmd, code, errmsg);
|
||||
|
||||
result_append(r, ", \"data\" : ");
|
||||
return r;
|
||||
|
@ -18,7 +18,7 @@ struct bitcoin_txid;
|
||||
struct channel_id;
|
||||
struct command;
|
||||
struct json_escaped;
|
||||
struct json_result;
|
||||
struct json_stream;
|
||||
struct pubkey;
|
||||
struct route_hop;
|
||||
struct sha256;
|
||||
@ -28,21 +28,21 @@ struct wireaddr;
|
||||
struct wireaddr_internal;
|
||||
|
||||
/* Output a route array. */
|
||||
void json_add_route(struct json_result *r, char const *n,
|
||||
void json_add_route(struct json_stream *r, char const *n,
|
||||
const struct route_hop *hops, size_t hops_len);
|
||||
|
||||
/* Output the fields of a wallet payment.
|
||||
* Should be used within an object context. */
|
||||
void json_add_payment_fields(struct json_result *response,
|
||||
void json_add_payment_fields(struct json_stream *response,
|
||||
const struct wallet_payment *t);
|
||||
|
||||
/* '"fieldname" : "0289abcdef..."' or "0289abcdef..." if fieldname is NULL */
|
||||
void json_add_pubkey(struct json_result *response,
|
||||
void json_add_pubkey(struct json_stream *response,
|
||||
const char *fieldname,
|
||||
const struct pubkey *key);
|
||||
|
||||
/* '"fieldname" : <hexrev>' or "<hexrev>" if fieldname is NULL */
|
||||
void json_add_txid(struct json_result *result, const char *fieldname,
|
||||
void json_add_txid(struct json_stream *result, const char *fieldname,
|
||||
const struct bitcoin_txid *txid);
|
||||
|
||||
/* Extract json array token */
|
||||
@ -134,7 +134,7 @@ bool json_tok_feerate(struct command *cmd, const char *name,
|
||||
u32 **feerate);
|
||||
|
||||
/* '"fieldname" : "1234:5:6"' */
|
||||
void json_add_short_channel_id(struct json_result *response,
|
||||
void json_add_short_channel_id(struct json_stream *response,
|
||||
const char *fieldname,
|
||||
const struct short_channel_id *id);
|
||||
|
||||
@ -142,11 +142,11 @@ bool json_tok_channel_id(const char *buffer, const jsmntok_t *tok,
|
||||
struct channel_id *cid);
|
||||
|
||||
/* JSON serialize a network address for a node */
|
||||
void json_add_address(struct json_result *response, const char *fieldname,
|
||||
void json_add_address(struct json_stream *response, const char *fieldname,
|
||||
const struct wireaddr *addr);
|
||||
|
||||
/* JSON serialize a network address for a node. */
|
||||
void json_add_address_internal(struct json_result *response,
|
||||
void json_add_address_internal(struct json_stream *response,
|
||||
const char *fieldname,
|
||||
const struct wireaddr_internal *addr);
|
||||
|
||||
@ -162,13 +162,13 @@ bool json_tok_tok(struct command *cmd, const char *name,
|
||||
/* Creating JSON output */
|
||||
|
||||
/* '"fieldname" : [ ' or '[ ' if fieldname is NULL */
|
||||
void json_array_start(struct json_result *ptr, const char *fieldname);
|
||||
void json_array_start(struct json_stream *ptr, const char *fieldname);
|
||||
/* '"fieldname" : { ' or '{ ' if fieldname is NULL */
|
||||
void json_object_start(struct json_result *ptr, const char *fieldname);
|
||||
void json_object_start(struct json_stream *ptr, const char *fieldname);
|
||||
/* ' ], ' */
|
||||
void json_array_end(struct json_result *ptr);
|
||||
void json_array_end(struct json_stream *ptr);
|
||||
/* ' }, ' */
|
||||
void json_object_end(struct json_result *ptr);
|
||||
void json_object_end(struct json_stream *ptr);
|
||||
|
||||
/**
|
||||
* json_stream_success - start streaming a successful json result.
|
||||
@ -177,7 +177,7 @@ void json_object_end(struct json_result *ptr);
|
||||
* The returned value should go to command_success() when done.
|
||||
* json_add_* will be placed into the 'result' field of the JSON reply.
|
||||
*/
|
||||
struct json_result *json_stream_success(struct command *cmd);
|
||||
struct json_stream *json_stream_success(struct command *cmd);
|
||||
|
||||
/**
|
||||
* json_stream_fail - start streaming a failed json result.
|
||||
@ -188,7 +188,7 @@ struct json_result *json_stream_success(struct command *cmd);
|
||||
* The returned value should go to command_failed() when done;
|
||||
* json_add_* will be placed into the 'data' field of the 'error' JSON reply.
|
||||
*/
|
||||
struct json_result *json_stream_fail(struct command *cmd,
|
||||
struct json_stream *json_stream_fail(struct command *cmd,
|
||||
int code,
|
||||
const char *errmsg);
|
||||
|
||||
@ -200,43 +200,43 @@ struct json_result *json_stream_fail(struct command *cmd,
|
||||
*
|
||||
* This is used by command_fail(), which doesn't add any JSON data.
|
||||
*/
|
||||
struct json_result *json_stream_fail_nodata(struct command *cmd,
|
||||
struct json_stream *json_stream_fail_nodata(struct command *cmd,
|
||||
int code,
|
||||
const char *errmsg);
|
||||
|
||||
/* '"fieldname" : "value"' or '"value"' if fieldname is NULL. Turns
|
||||
* any non-printable chars into JSON escapes, but leaves existing escapes alone.
|
||||
*/
|
||||
void json_add_string(struct json_result *result, const char *fieldname, const char *value);
|
||||
void json_add_string(struct json_stream *result, const char *fieldname, const char *value);
|
||||
|
||||
/* '"fieldname" : "value"' or '"value"' if fieldname is NULL. String must
|
||||
* already be JSON escaped as necessary. */
|
||||
void json_add_escaped_string(struct json_result *result,
|
||||
void json_add_escaped_string(struct json_stream *result,
|
||||
const char *fieldname,
|
||||
const struct json_escaped *esc TAKES);
|
||||
|
||||
/* '"fieldname" : literal' or 'literal' if fieldname is NULL*/
|
||||
void json_add_literal(struct json_result *result, const char *fieldname,
|
||||
void json_add_literal(struct json_stream *result, const char *fieldname,
|
||||
const char *literal, int len);
|
||||
/* '"fieldname" : value' or 'value' if fieldname is NULL */
|
||||
void json_add_double(struct json_result *result, const char *fieldname,
|
||||
void json_add_double(struct json_stream *result, const char *fieldname,
|
||||
double value);
|
||||
/* '"fieldname" : value' or 'value' if fieldname is NULL */
|
||||
void json_add_num(struct json_result *result, const char *fieldname,
|
||||
void json_add_num(struct json_stream *result, const char *fieldname,
|
||||
unsigned int value);
|
||||
/* '"fieldname" : value' or 'value' if fieldname is NULL */
|
||||
void json_add_u64(struct json_result *result, const char *fieldname,
|
||||
void json_add_u64(struct json_stream *result, const char *fieldname,
|
||||
uint64_t value);
|
||||
/* '"fieldname" : true|false' or 'true|false' if fieldname is NULL */
|
||||
void json_add_bool(struct json_result *result, const char *fieldname,
|
||||
void json_add_bool(struct json_stream *result, const char *fieldname,
|
||||
bool value);
|
||||
/* '"fieldname" : "0189abcdef..."' or "0189abcdef..." if fieldname is NULL */
|
||||
void json_add_hex(struct json_result *result, const char *fieldname,
|
||||
void json_add_hex(struct json_stream *result, const char *fieldname,
|
||||
const void *data, size_t len);
|
||||
/* '"fieldname" : "0189abcdef..."' or "0189abcdef..." if fieldname is NULL */
|
||||
void json_add_hex_talarr(struct json_result *result,
|
||||
void json_add_hex_talarr(struct json_stream *result,
|
||||
const char *fieldname,
|
||||
const tal_t *data);
|
||||
void json_add_object(struct json_result *result, ...);
|
||||
void json_add_object(struct json_stream *result, ...);
|
||||
|
||||
#endif /* LIGHTNING_LIGHTNINGD_JSON_H */
|
||||
|
@ -80,7 +80,7 @@ AUTODATA(json_command, &help_command);
|
||||
static void json_stop(struct command *cmd,
|
||||
const char *buffer UNUSED, const jsmntok_t *params UNUSED)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
|
||||
if (!param(cmd, buffer, params, NULL))
|
||||
return;
|
||||
@ -103,7 +103,7 @@ AUTODATA(json_command, &stop_command);
|
||||
static void json_rhash(struct command *cmd,
|
||||
const char *buffer, const jsmntok_t *params)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct sha256 *secret;
|
||||
|
||||
if (!param(cmd, buffer, params,
|
||||
@ -147,7 +147,7 @@ AUTODATA(json_command, &dev_crash_command);
|
||||
static void json_getinfo(struct command *cmd,
|
||||
const char *buffer UNUSED, const jsmntok_t *params UNUSED)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
|
||||
if (!param(cmd, buffer, params, NULL))
|
||||
return;
|
||||
@ -199,7 +199,7 @@ static struct json_command **get_cmdlist(void)
|
||||
}
|
||||
|
||||
static void json_add_help_command(struct command *cmd,
|
||||
struct json_result *response,
|
||||
struct json_stream *response,
|
||||
struct json_command *json_command)
|
||||
{
|
||||
char *usage;
|
||||
@ -232,7 +232,7 @@ static void json_help(struct command *cmd,
|
||||
const char *buffer, const jsmntok_t *params)
|
||||
{
|
||||
unsigned int i;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct json_command **cmdlist = get_cmdlist();
|
||||
const jsmntok_t *cmdtok;
|
||||
|
||||
@ -334,9 +334,9 @@ void jcon_append_vfmt(struct json_connection *jcon, const char *fmt, va_list ap)
|
||||
io_wake(jcon);
|
||||
}
|
||||
|
||||
struct json_result *null_response(struct command *cmd)
|
||||
struct json_stream *null_response(struct command *cmd)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
|
||||
response = json_stream_success(cmd);
|
||||
json_object_start(response, NULL);
|
||||
@ -358,7 +358,7 @@ static void destroy_command(struct command *cmd)
|
||||
}
|
||||
|
||||
/* FIXME: Remove result arg here! */
|
||||
void command_success(struct command *cmd, struct json_result *result)
|
||||
void command_success(struct command *cmd, struct json_stream *result)
|
||||
{
|
||||
assert(cmd);
|
||||
assert(cmd->have_json_stream);
|
||||
@ -370,7 +370,7 @@ void command_success(struct command *cmd, struct json_result *result)
|
||||
}
|
||||
|
||||
/* FIXME: Remove result arg here! */
|
||||
void command_failed(struct command *cmd, struct json_result *result)
|
||||
void command_failed(struct command *cmd, struct json_stream *result)
|
||||
{
|
||||
assert(cmd->have_json_stream);
|
||||
/* Have to close error */
|
||||
@ -385,7 +385,7 @@ void PRINTF_FMT(3, 4) command_fail(struct command *cmd, int code,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
const char *errmsg;
|
||||
struct json_result *r;
|
||||
struct json_stream *r;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
@ -85,9 +85,9 @@ struct json_command {
|
||||
const char *verbose;
|
||||
};
|
||||
|
||||
struct json_result *null_response(struct command *cmd);
|
||||
void command_success(struct command *cmd, struct json_result *response);
|
||||
void command_failed(struct command *cmd, struct json_result *result);
|
||||
struct json_stream *null_response(struct command *cmd);
|
||||
void command_success(struct command *cmd, struct json_stream *response);
|
||||
void command_failed(struct command *cmd, struct json_stream *result);
|
||||
void PRINTF_FMT(3, 4) command_fail(struct command *cmd, int code,
|
||||
const char *fmt, ...);
|
||||
|
||||
|
@ -616,7 +616,7 @@ void fatal(const char *fmt, ...)
|
||||
|
||||
struct log_info {
|
||||
enum log_level level;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
unsigned int num_skipped;
|
||||
};
|
||||
|
||||
@ -631,7 +631,7 @@ static void add_skipped(struct log_info *info)
|
||||
}
|
||||
}
|
||||
|
||||
static void json_add_time(struct json_result *result, const char *fieldname,
|
||||
static void json_add_time(struct json_stream *result, const char *fieldname,
|
||||
struct timespec ts)
|
||||
{
|
||||
char timebuf[100];
|
||||
@ -677,7 +677,7 @@ static void log_to_json(unsigned int skipped,
|
||||
json_object_end(info->response);
|
||||
}
|
||||
|
||||
void json_add_log(struct json_result *response,
|
||||
void json_add_log(struct json_stream *response,
|
||||
const struct log_book *lr, enum log_level minlevel)
|
||||
{
|
||||
struct log_info info;
|
||||
@ -718,7 +718,7 @@ bool json_tok_loglevel(struct command *cmd, const char *name,
|
||||
static void json_getlog(struct command *cmd,
|
||||
const char *buffer, const jsmntok_t * params)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
enum log_level *minlevel;
|
||||
struct log_book *lr = cmd->ld->log_book;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
struct command;
|
||||
struct json_result;
|
||||
struct json_stream;
|
||||
struct lightningd;
|
||||
struct timerel;
|
||||
|
||||
@ -100,7 +100,7 @@ void log_backtrace_print(const char *fmt, ...);
|
||||
void log_backtrace_exit(void);
|
||||
|
||||
/* Adds an array showing log entries */
|
||||
void json_add_log(struct json_result *result,
|
||||
void json_add_log(struct json_stream *result,
|
||||
const struct log_book *lr, enum log_level minlevel);
|
||||
|
||||
bool json_tok_loglevel(struct command *cmd, const char *name,
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <lightningd/param.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static void json_add_ptr(struct json_result *response, const char *name,
|
||||
static void json_add_ptr(struct json_stream *response, const char *name,
|
||||
const void *ptr)
|
||||
{
|
||||
char ptrstr[STR_MAX_CHARS(void *)];
|
||||
@ -21,7 +21,7 @@ static void json_add_ptr(struct json_result *response, const char *name,
|
||||
json_add_string(response, name, ptrstr);
|
||||
}
|
||||
|
||||
static void add_memdump(struct json_result *response,
|
||||
static void add_memdump(struct json_stream *response,
|
||||
const char *name, const tal_t *root,
|
||||
struct command *cmd)
|
||||
{
|
||||
@ -56,7 +56,7 @@ static void json_memdump(struct command *cmd,
|
||||
const char *buffer UNNEEDED,
|
||||
const jsmntok_t *params UNNEEDED)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
|
||||
if (!param(cmd, buffer, params, NULL))
|
||||
return;
|
||||
@ -78,7 +78,7 @@ static int json_add_syminfo(void *data, uintptr_t pc UNUSED,
|
||||
const char *filename, int lineno,
|
||||
const char *function)
|
||||
{
|
||||
struct json_result *response = data;
|
||||
struct json_stream *response = data;
|
||||
char *str;
|
||||
|
||||
/* This can happen in backtraces. */
|
||||
@ -91,7 +91,7 @@ static int json_add_syminfo(void *data, uintptr_t pc UNUSED,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void json_add_backtrace(struct json_result *response,
|
||||
static void json_add_backtrace(struct json_stream *response,
|
||||
const uintptr_t *bt)
|
||||
{
|
||||
size_t i;
|
||||
@ -110,7 +110,7 @@ static void json_add_backtrace(struct json_result *response,
|
||||
}
|
||||
|
||||
static void scan_mem(struct command *cmd,
|
||||
struct json_result *response,
|
||||
struct json_stream *response,
|
||||
struct lightningd *ld)
|
||||
{
|
||||
struct htable *memtable;
|
||||
@ -154,7 +154,7 @@ static void json_memleak(struct command *cmd,
|
||||
const char *buffer UNNEEDED,
|
||||
const jsmntok_t *params UNNEEDED)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
|
||||
if (!param(cmd, buffer, params, NULL))
|
||||
return;
|
||||
|
@ -99,7 +99,7 @@ void kill_uncommitted_channel(struct uncommitted_channel *uc,
|
||||
tal_free(uc);
|
||||
}
|
||||
|
||||
void json_add_uncommitted_channel(struct json_result *response,
|
||||
void json_add_uncommitted_channel(struct json_stream *response,
|
||||
const struct uncommitted_channel *uc)
|
||||
{
|
||||
u64 msatoshi_total, our_msatoshi;
|
||||
@ -236,7 +236,7 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp,
|
||||
u32 feerate;
|
||||
u64 change_satoshi;
|
||||
struct channel *channel;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct lightningd *ld = openingd->ld;
|
||||
struct channel_id cid;
|
||||
|
||||
|
@ -5,11 +5,11 @@
|
||||
|
||||
struct channel_id;
|
||||
struct crypto_state;
|
||||
struct json_result;
|
||||
struct json_stream;
|
||||
struct lightningd;
|
||||
struct uncommitted_channel;
|
||||
|
||||
void json_add_uncommitted_channel(struct json_result *response,
|
||||
void json_add_uncommitted_channel(struct json_stream *response,
|
||||
const struct uncommitted_channel *uc);
|
||||
|
||||
void peer_start_openingd(struct peer *peer,
|
||||
|
@ -856,7 +856,7 @@ static const char *next_name(const char *names, unsigned *len)
|
||||
return first_name(names + 1, len);
|
||||
}
|
||||
|
||||
static void json_add_opt_addrs(struct json_result *response,
|
||||
static void json_add_opt_addrs(struct json_stream *response,
|
||||
const char *name0,
|
||||
const struct wireaddr_internal *wireaddrs,
|
||||
const enum addr_listen_announce *listen_announce,
|
||||
@ -872,7 +872,7 @@ static void json_add_opt_addrs(struct json_result *response,
|
||||
}
|
||||
|
||||
static void add_config(struct lightningd *ld,
|
||||
struct json_result *response,
|
||||
struct json_stream *response,
|
||||
const struct opt_table *opt,
|
||||
const char *name, size_t len)
|
||||
{
|
||||
@ -978,7 +978,7 @@ static void json_listconfigs(struct command *cmd,
|
||||
const char *buffer, const jsmntok_t *params)
|
||||
{
|
||||
size_t i;
|
||||
struct json_result *response = NULL;
|
||||
struct json_stream *response = NULL;
|
||||
const jsmntok_t *configtok;
|
||||
|
||||
if (!param(cmd, buffer, params,
|
||||
|
@ -847,7 +847,7 @@ static void
|
||||
json_sendpay_success(struct command *cmd,
|
||||
const struct sendpay_result *r)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
|
||||
assert(r->payment->status == PAYMENT_COMPLETE);
|
||||
|
||||
@ -869,7 +869,7 @@ static void json_waitsendpay_on_resolve(const struct sendpay_result *r,
|
||||
if (r->succeeded)
|
||||
json_sendpay_success(cmd, r);
|
||||
else {
|
||||
struct json_result *data;
|
||||
struct json_stream *data;
|
||||
switch (r->errorcode) {
|
||||
/* We will never handle this case */
|
||||
case PAY_IN_PROGRESS:
|
||||
@ -929,7 +929,7 @@ static void json_sendpay_on_resolve(const struct sendpay_result* r,
|
||||
|
||||
if (!r->succeeded && r->errorcode == PAY_IN_PROGRESS) {
|
||||
/* This is normal for sendpay. Succeed. */
|
||||
struct json_result *response = json_stream_success(cmd);
|
||||
struct json_stream *response = json_stream_success(cmd);
|
||||
json_object_start(response, NULL);
|
||||
json_add_string(response, "message",
|
||||
"Monitor status with listpayments or waitsendpay");
|
||||
@ -1058,7 +1058,7 @@ static void json_listpayments(struct command *cmd, const char *buffer,
|
||||
const jsmntok_t *params)
|
||||
{
|
||||
const struct wallet_payment **payments;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct sha256 *rhash;
|
||||
const char *b11str;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <wire/gen_onion_wire.h>
|
||||
|
||||
struct htlc_out;
|
||||
struct json_result;
|
||||
struct json_stream;
|
||||
struct lightningd;
|
||||
struct route_hop;
|
||||
struct sha256;
|
||||
@ -95,7 +95,7 @@ void payment_store(struct lightningd *ld, const struct sha256 *payment_hash);
|
||||
/* Output the fields of a payment. Caller should have put the
|
||||
* response within a JSON object and is responsible for
|
||||
* closing the object. */
|
||||
void json_add_payment_fields(struct json_result *response,
|
||||
void json_add_payment_fields(struct json_stream *response,
|
||||
const struct wallet_payment *t);
|
||||
|
||||
#endif /* LIGHTNING_LIGHTNINGD_PAY_H */
|
||||
|
@ -47,7 +47,7 @@ struct pay_failure {
|
||||
|
||||
/* Output a pay failure */
|
||||
static void
|
||||
json_add_failure(struct json_result *r, char const *n,
|
||||
json_add_failure(struct json_stream *r, char const *n,
|
||||
const struct pay_failure *f)
|
||||
{
|
||||
struct routing_failure *rf;
|
||||
@ -78,7 +78,7 @@ json_add_failure(struct json_result *r, char const *n,
|
||||
|
||||
/* Output an array of payment failures. */
|
||||
static void
|
||||
json_add_failures(struct json_result *r, char const *n,
|
||||
json_add_failures(struct json_stream *r, char const *n,
|
||||
const struct list_head *fs)
|
||||
{
|
||||
struct pay_failure *f;
|
||||
@ -194,7 +194,7 @@ json_pay_success(struct pay *pay,
|
||||
const struct sendpay_result *r)
|
||||
{
|
||||
struct command *cmd = pay->cmd;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
|
||||
response = json_stream_success(cmd);
|
||||
json_object_start(response, NULL);
|
||||
@ -211,7 +211,7 @@ json_pay_success(struct pay *pay,
|
||||
static void json_pay_failure(struct pay *pay,
|
||||
const struct sendpay_result *r)
|
||||
{
|
||||
struct json_result *data;
|
||||
struct json_stream *data;
|
||||
struct routing_failure *fail;
|
||||
|
||||
assert(!r->succeeded);
|
||||
@ -409,7 +409,7 @@ static void json_pay_getroute_reply(struct subd *gossip UNUSED,
|
||||
double feepercent;
|
||||
bool fee_too_high;
|
||||
bool delay_too_high;
|
||||
struct json_result *data;
|
||||
struct json_stream *data;
|
||||
char const *err;
|
||||
|
||||
fromwire_gossip_getroute_reply(reply, reply, &route);
|
||||
@ -510,7 +510,7 @@ static bool json_pay_try(struct pay *pay)
|
||||
|
||||
/* If too late anyway, fail now. */
|
||||
if (time_after(now, pay->expiry)) {
|
||||
struct json_result *data
|
||||
struct json_stream *data
|
||||
= json_stream_fail(cmd, PAY_INVOICE_EXPIRED,
|
||||
"Invoice expired");
|
||||
json_object_start(data, NULL);
|
||||
|
@ -232,7 +232,7 @@ static void remove_sig(struct bitcoin_tx *signed_tx)
|
||||
static void
|
||||
resolve_one_close_command(struct close_command *cc, bool cooperative)
|
||||
{
|
||||
struct json_result *result = json_stream_success(cc->cmd);
|
||||
struct json_stream *result = json_stream_success(cc->cmd);
|
||||
u8 *tx = linearize_tx(result, cc->channel->last_tx);
|
||||
struct bitcoin_txid txid;
|
||||
|
||||
@ -597,7 +597,7 @@ void channel_watch_funding(struct lightningd *ld, struct channel *channel)
|
||||
}
|
||||
|
||||
static void json_add_htlcs(struct lightningd *ld,
|
||||
struct json_result *response,
|
||||
struct json_stream *response,
|
||||
const struct channel *channel)
|
||||
{
|
||||
/* FIXME: make per-channel htlc maps! */
|
||||
@ -647,7 +647,7 @@ static void json_add_htlcs(struct lightningd *ld,
|
||||
}
|
||||
|
||||
static void json_add_peer(struct lightningd *ld,
|
||||
struct json_result *response,
|
||||
struct json_stream *response,
|
||||
struct peer *p,
|
||||
const enum log_level *ll)
|
||||
{
|
||||
@ -818,7 +818,7 @@ static void json_listpeers(struct command *cmd,
|
||||
enum log_level *ll;
|
||||
struct pubkey *specific_id;
|
||||
struct peer *peer;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
|
||||
if (!param(cmd, buffer, params,
|
||||
p_opt("id", json_tok_pubkey, &specific_id),
|
||||
@ -1084,7 +1084,7 @@ static void json_sign_last_tx(struct command *cmd,
|
||||
{
|
||||
struct pubkey *peerid;
|
||||
struct peer *peer;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
u8 *linear;
|
||||
struct channel *channel;
|
||||
|
||||
@ -1233,7 +1233,7 @@ static void process_dev_forget_channel(struct bitcoind *bitcoind UNUSED,
|
||||
const struct bitcoin_tx_output *txout,
|
||||
void *arg)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct dev_forget_channel_cmd *forget = arg;
|
||||
if (txout != NULL && !forget->force) {
|
||||
command_fail(forget->cmd, LIGHTNINGD,
|
||||
|
@ -69,7 +69,7 @@ void ping_reply(struct subd *subd, const u8 *msg)
|
||||
else if (!sent)
|
||||
command_fail(pc->cmd, LIGHTNINGD, "Unknown peer");
|
||||
else {
|
||||
struct json_result *response = json_stream_success(pc->cmd);
|
||||
struct json_stream *response = json_stream_success(pc->cmd);
|
||||
|
||||
json_object_start(response, NULL);
|
||||
json_add_num(response, "totlen", totlen);
|
||||
|
@ -49,13 +49,13 @@ void command_fail(struct command *cmd UNNEEDED, int code UNNEEDED,
|
||||
const char *fmt UNNEEDED, ...)
|
||||
{ fprintf(stderr, "command_fail called!\n"); abort(); }
|
||||
/* Generated stub for command_failed */
|
||||
void command_failed(struct command *cmd UNNEEDED, struct json_result *result UNNEEDED)
|
||||
void command_failed(struct command *cmd UNNEEDED, struct json_stream *result UNNEEDED)
|
||||
{ fprintf(stderr, "command_failed called!\n"); abort(); }
|
||||
/* Generated stub for command_still_pending */
|
||||
void command_still_pending(struct command *cmd UNNEEDED)
|
||||
{ fprintf(stderr, "command_still_pending called!\n"); abort(); }
|
||||
/* Generated stub for command_success */
|
||||
void command_success(struct command *cmd UNNEEDED, struct json_result *response UNNEEDED)
|
||||
void command_success(struct command *cmd UNNEEDED, struct json_stream *response UNNEEDED)
|
||||
{ fprintf(stderr, "command_success called!\n"); abort(); }
|
||||
/* Generated stub for connect_succeeded */
|
||||
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct pubkey *id UNNEEDED)
|
||||
@ -94,78 +94,78 @@ void htlcs_reconnect(struct lightningd *ld UNNEEDED,
|
||||
struct htlc_out_map *htlcs_out UNNEEDED)
|
||||
{ fprintf(stderr, "htlcs_reconnect called!\n"); abort(); }
|
||||
/* Generated stub for json_add_bool */
|
||||
void json_add_bool(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
void json_add_bool(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
bool value UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_bool called!\n"); abort(); }
|
||||
/* Generated stub for json_add_escaped_string */
|
||||
void json_add_escaped_string(struct json_result *result UNNEEDED,
|
||||
void json_add_escaped_string(struct json_stream *result UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
const struct json_escaped *esc TAKES UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_escaped_string called!\n"); abort(); }
|
||||
/* Generated stub for json_add_hex */
|
||||
void json_add_hex(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
void json_add_hex(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
const void *data UNNEEDED, size_t len UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_hex called!\n"); abort(); }
|
||||
/* Generated stub for json_add_hex_talarr */
|
||||
void json_add_hex_talarr(struct json_result *result UNNEEDED,
|
||||
void json_add_hex_talarr(struct json_stream *result UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
const tal_t *data UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); }
|
||||
/* Generated stub for json_add_log */
|
||||
void json_add_log(struct json_result *result UNNEEDED,
|
||||
void json_add_log(struct json_stream *result UNNEEDED,
|
||||
const struct log_book *lr UNNEEDED, enum log_level minlevel UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_log called!\n"); abort(); }
|
||||
/* Generated stub for json_add_num */
|
||||
void json_add_num(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
unsigned int value UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_num called!\n"); abort(); }
|
||||
/* Generated stub for json_add_pubkey */
|
||||
void json_add_pubkey(struct json_result *response UNNEEDED,
|
||||
void json_add_pubkey(struct json_stream *response UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
const struct pubkey *key UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for json_add_short_channel_id */
|
||||
void json_add_short_channel_id(struct json_result *response UNNEEDED,
|
||||
void json_add_short_channel_id(struct json_stream *response UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
const struct short_channel_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for json_add_string */
|
||||
void json_add_string(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED, const char *value UNNEEDED)
|
||||
void json_add_string(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, const char *value UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_string called!\n"); abort(); }
|
||||
/* Generated stub for json_add_txid */
|
||||
void json_add_txid(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
void json_add_txid(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
const struct bitcoin_txid *txid UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_txid called!\n"); abort(); }
|
||||
/* Generated stub for json_add_u64 */
|
||||
void json_add_u64(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
void json_add_u64(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
uint64_t value UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_u64 called!\n"); abort(); }
|
||||
/* Generated stub for json_add_uncommitted_channel */
|
||||
void json_add_uncommitted_channel(struct json_result *response UNNEEDED,
|
||||
void json_add_uncommitted_channel(struct json_stream *response UNNEEDED,
|
||||
const struct uncommitted_channel *uc UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_uncommitted_channel called!\n"); abort(); }
|
||||
/* Generated stub for json_array_end */
|
||||
void json_array_end(struct json_result *ptr UNNEEDED)
|
||||
void json_array_end(struct json_stream *ptr UNNEEDED)
|
||||
{ fprintf(stderr, "json_array_end called!\n"); abort(); }
|
||||
/* Generated stub for json_array_start */
|
||||
void json_array_start(struct json_result *ptr UNNEEDED, const char *fieldname UNNEEDED)
|
||||
void json_array_start(struct json_stream *ptr UNNEEDED, const char *fieldname UNNEEDED)
|
||||
{ fprintf(stderr, "json_array_start called!\n"); abort(); }
|
||||
/* Generated stub for json_escape */
|
||||
struct json_escaped *json_escape(const tal_t *ctx UNNEEDED, const char *str TAKES UNNEEDED)
|
||||
{ fprintf(stderr, "json_escape called!\n"); abort(); }
|
||||
/* Generated stub for json_object_end */
|
||||
void json_object_end(struct json_result *ptr UNNEEDED)
|
||||
void json_object_end(struct json_stream *ptr UNNEEDED)
|
||||
{ fprintf(stderr, "json_object_end called!\n"); abort(); }
|
||||
/* Generated stub for json_object_start */
|
||||
void json_object_start(struct json_result *ptr UNNEEDED, const char *fieldname UNNEEDED)
|
||||
void json_object_start(struct json_stream *ptr UNNEEDED, const char *fieldname UNNEEDED)
|
||||
{ fprintf(stderr, "json_object_start called!\n"); abort(); }
|
||||
/* Generated stub for json_stream_fail */
|
||||
struct json_result *json_stream_fail(struct command *cmd UNNEEDED,
|
||||
struct json_stream *json_stream_fail(struct command *cmd UNNEEDED,
|
||||
int code UNNEEDED,
|
||||
const char *errmsg UNNEEDED)
|
||||
{ fprintf(stderr, "json_stream_fail called!\n"); abort(); }
|
||||
/* Generated stub for json_stream_success */
|
||||
struct json_result *json_stream_success(struct command *cmd UNNEEDED)
|
||||
struct json_stream *json_stream_success(struct command *cmd UNNEEDED)
|
||||
{ fprintf(stderr, "json_stream_success called!\n"); abort(); }
|
||||
/* Generated stub for json_tok_address_scriptpubkey */
|
||||
enum address_parse_result json_tok_address_scriptpubkey(const tal_t *ctx UNNEEDED,
|
||||
@ -277,7 +277,7 @@ struct oneshot *new_reltimer_(struct timers *timers UNNEEDED,
|
||||
void (*cb)(void *) UNNEEDED, void *arg UNNEEDED)
|
||||
{ fprintf(stderr, "new_reltimer_ called!\n"); abort(); }
|
||||
/* Generated stub for null_response */
|
||||
struct json_result *null_response(struct command *cmd UNNEEDED)
|
||||
struct json_stream *null_response(struct command *cmd UNNEEDED)
|
||||
{ fprintf(stderr, "null_response called!\n"); abort(); }
|
||||
/* Generated stub for onchaind_funding_spent */
|
||||
enum watch_result onchaind_funding_spent(struct channel *channel UNNEEDED,
|
||||
|
@ -60,7 +60,7 @@ static int test_json_filter(void)
|
||||
{
|
||||
struct command *cmd = talz(NULL, struct command);
|
||||
struct json_connection *jcon = talz(cmd, struct json_connection);
|
||||
struct json_result *result = json_stream_success(cmd);
|
||||
struct json_stream *result = json_stream_success(cmd);
|
||||
jsmntok_t *toks;
|
||||
const jsmntok_t *x;
|
||||
bool valid;
|
||||
@ -114,7 +114,7 @@ static void test_json_escape(void)
|
||||
char badstr[2];
|
||||
struct command *cmd = talz(NULL, struct command);
|
||||
struct json_connection *jcon = talz(cmd, struct json_connection);
|
||||
struct json_result *result = json_stream_success(cmd);
|
||||
struct json_stream *result = json_stream_success(cmd);
|
||||
struct json_escaped *esc;
|
||||
|
||||
badstr[0] = i;
|
||||
|
@ -58,7 +58,7 @@ void command_fail(struct command *cmd UNNEEDED, int code UNNEEDED,
|
||||
void command_still_pending(struct command *cmd UNNEEDED)
|
||||
{ fprintf(stderr, "command_still_pending called!\n"); abort(); }
|
||||
/* Generated stub for command_success */
|
||||
void command_success(struct command *cmd UNNEEDED, struct json_result *response UNNEEDED)
|
||||
void command_success(struct command *cmd UNNEEDED, struct json_stream *response UNNEEDED)
|
||||
{ fprintf(stderr, "command_success called!\n"); abort(); }
|
||||
/* Generated stub for connect_succeeded */
|
||||
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct pubkey *id UNNEEDED)
|
||||
@ -173,69 +173,69 @@ void invoices_waitone(const tal_t *ctx UNNEEDED,
|
||||
void *cbarg UNNEEDED)
|
||||
{ fprintf(stderr, "invoices_waitone called!\n"); abort(); }
|
||||
/* Generated stub for json_add_bool */
|
||||
void json_add_bool(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
void json_add_bool(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
bool value UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_bool called!\n"); abort(); }
|
||||
/* Generated stub for json_add_hex */
|
||||
void json_add_hex(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
void json_add_hex(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
const void *data UNNEEDED, size_t len UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_hex called!\n"); abort(); }
|
||||
/* Generated stub for json_add_hex_talarr */
|
||||
void json_add_hex_talarr(struct json_result *result UNNEEDED,
|
||||
void json_add_hex_talarr(struct json_stream *result UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
const tal_t *data UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); }
|
||||
/* Generated stub for json_add_log */
|
||||
void json_add_log(struct json_result *result UNNEEDED,
|
||||
void json_add_log(struct json_stream *result UNNEEDED,
|
||||
const struct log_book *lr UNNEEDED, enum log_level minlevel UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_log called!\n"); abort(); }
|
||||
/* Generated stub for json_add_num */
|
||||
void json_add_num(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
unsigned int value UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_num called!\n"); abort(); }
|
||||
/* Generated stub for json_add_pubkey */
|
||||
void json_add_pubkey(struct json_result *response UNNEEDED,
|
||||
void json_add_pubkey(struct json_stream *response UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
const struct pubkey *key UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for json_add_short_channel_id */
|
||||
void json_add_short_channel_id(struct json_result *response UNNEEDED,
|
||||
void json_add_short_channel_id(struct json_stream *response UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
const struct short_channel_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for json_add_string */
|
||||
void json_add_string(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED, const char *value UNNEEDED)
|
||||
void json_add_string(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, const char *value UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_string called!\n"); abort(); }
|
||||
/* Generated stub for json_add_txid */
|
||||
void json_add_txid(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
void json_add_txid(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
const struct bitcoin_txid *txid UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_txid called!\n"); abort(); }
|
||||
/* Generated stub for json_add_u64 */
|
||||
void json_add_u64(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
void json_add_u64(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
uint64_t value UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_u64 called!\n"); abort(); }
|
||||
/* Generated stub for json_add_uncommitted_channel */
|
||||
void json_add_uncommitted_channel(struct json_result *response UNNEEDED,
|
||||
void json_add_uncommitted_channel(struct json_stream *response UNNEEDED,
|
||||
const struct uncommitted_channel *uc UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_uncommitted_channel called!\n"); abort(); }
|
||||
/* Generated stub for json_array_end */
|
||||
void json_array_end(struct json_result *ptr UNNEEDED)
|
||||
void json_array_end(struct json_stream *ptr UNNEEDED)
|
||||
{ fprintf(stderr, "json_array_end called!\n"); abort(); }
|
||||
/* Generated stub for json_array_start */
|
||||
void json_array_start(struct json_result *ptr UNNEEDED, const char *fieldname UNNEEDED)
|
||||
void json_array_start(struct json_stream *ptr UNNEEDED, const char *fieldname UNNEEDED)
|
||||
{ fprintf(stderr, "json_array_start called!\n"); abort(); }
|
||||
/* Generated stub for json_escaped_string_ */
|
||||
struct json_escaped *json_escaped_string_(const tal_t *ctx UNNEEDED,
|
||||
const void *bytes UNNEEDED, size_t len UNNEEDED)
|
||||
{ fprintf(stderr, "json_escaped_string_ called!\n"); abort(); }
|
||||
/* Generated stub for json_object_end */
|
||||
void json_object_end(struct json_result *ptr UNNEEDED)
|
||||
void json_object_end(struct json_stream *ptr UNNEEDED)
|
||||
{ fprintf(stderr, "json_object_end called!\n"); abort(); }
|
||||
/* Generated stub for json_object_start */
|
||||
void json_object_start(struct json_result *ptr UNNEEDED, const char *fieldname UNNEEDED)
|
||||
void json_object_start(struct json_stream *ptr UNNEEDED, const char *fieldname UNNEEDED)
|
||||
{ fprintf(stderr, "json_object_start called!\n"); abort(); }
|
||||
/* Generated stub for json_stream_success */
|
||||
struct json_result *json_stream_success(struct command *cmd UNNEEDED)
|
||||
struct json_stream *json_stream_success(struct command *cmd UNNEEDED)
|
||||
{ fprintf(stderr, "json_stream_success called!\n"); abort(); }
|
||||
/* Generated stub for json_tok_bool */
|
||||
bool json_tok_bool(struct command *cmd UNNEEDED, const char *name UNNEEDED,
|
||||
@ -291,7 +291,7 @@ void log_io(struct log *log UNNEEDED, enum log_level dir UNNEEDED, const char *c
|
||||
const void *data UNNEEDED, size_t len UNNEEDED)
|
||||
{ fprintf(stderr, "log_io called!\n"); abort(); }
|
||||
/* Generated stub for null_response */
|
||||
struct json_result *null_response(struct command *cmd UNNEEDED)
|
||||
struct json_stream *null_response(struct command *cmd UNNEEDED)
|
||||
{ fprintf(stderr, "null_response called!\n"); abort(); }
|
||||
/* Generated stub for onchaind_funding_spent */
|
||||
enum watch_result onchaind_funding_spent(struct channel *channel UNNEEDED,
|
||||
|
@ -65,7 +65,7 @@ static void wallet_withdrawal_broadcast(struct bitcoind *bitcoind UNUSED,
|
||||
* not if we're actually making a payment to ourselves! */
|
||||
assert(change_satoshi >= withdraw->wtx.change);
|
||||
|
||||
struct json_result *response = json_stream_success(cmd);
|
||||
struct json_stream *response = json_stream_success(cmd);
|
||||
json_object_start(response, NULL);
|
||||
json_add_string(response, "tx", withdraw->hextx);
|
||||
json_add_string(response, "txid", output);
|
||||
@ -242,7 +242,7 @@ static bool json_tok_newaddr(struct command *cmd, const char *name,
|
||||
static void json_newaddr(struct command *cmd, const char *buffer UNUSED,
|
||||
const jsmntok_t *params UNUSED)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct ext_key ext;
|
||||
struct pubkey pubkey;
|
||||
bool *is_p2wpkh;
|
||||
@ -301,7 +301,7 @@ AUTODATA(json_command, &newaddr_command);
|
||||
static void json_listaddrs(struct command *cmd,
|
||||
const char *buffer, const jsmntok_t *params)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct ext_key ext;
|
||||
struct pubkey pubkey;
|
||||
u64 *bip32_max_index;
|
||||
@ -379,7 +379,7 @@ AUTODATA(json_command, &listaddrs_command);
|
||||
static void json_listfunds(struct command *cmd, const char *buffer UNUSED,
|
||||
const jsmntok_t *params UNUSED)
|
||||
{
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
struct peer *p;
|
||||
struct utxo **utxos;
|
||||
char* out;
|
||||
@ -464,7 +464,7 @@ AUTODATA(json_command, &listfunds_command);
|
||||
struct txo_rescan {
|
||||
struct command *cmd;
|
||||
struct utxo **utxos;
|
||||
struct json_result *response;
|
||||
struct json_stream *response;
|
||||
};
|
||||
|
||||
static void process_utxo_result(struct bitcoind *bitcoind,
|
||||
@ -472,7 +472,7 @@ static void process_utxo_result(struct bitcoind *bitcoind,
|
||||
void *arg)
|
||||
{
|
||||
struct txo_rescan *rescan = arg;
|
||||
struct json_result *response = rescan->response;
|
||||
struct json_stream *response = rescan->response;
|
||||
struct utxo *u = rescan->utxos[0];
|
||||
enum output_status newstate =
|
||||
txout == NULL ? output_state_spent : output_state_available;
|
||||
|
Loading…
Reference in New Issue
Block a user