Browse Source

Rename `struct json_result` to `struct json_stream` (RENAMEONLY)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.2rc1
Rusty Russell 6 years ago
parent
commit
0dcd66880c
  1. 2
      lightningd/chaintopology.c
  2. 2
      lightningd/connect_control.c
  3. 12
      lightningd/gossip_control.c
  4. 16
      lightningd/invoice.c
  5. 76
      lightningd/json.c
  6. 50
      lightningd/json.h
  7. 20
      lightningd/jsonrpc.c
  8. 6
      lightningd/jsonrpc.h
  9. 8
      lightningd/log.c
  10. 4
      lightningd/log.h
  11. 14
      lightningd/memdump.c
  12. 4
      lightningd/opening_control.c
  13. 4
      lightningd/opening_control.h
  14. 6
      lightningd/options.c
  15. 8
      lightningd/pay.c
  16. 4
      lightningd/pay.h
  17. 12
      lightningd/payalgo.c
  18. 12
      lightningd/peer_control.c
  19. 2
      lightningd/ping.c
  20. 42
      lightningd/test/run-invoice-select-inchan.c
  21. 4
      lightningd/test/run-jsonrpc.c
  22. 36
      wallet/test/run-wallet.c
  23. 12
      wallet/walletrpc.c

2
lightningd/chaintopology.c

@ -466,7 +466,7 @@ static void json_feerates(struct command *cmd,
const char *buffer, const jsmntok_t *params) const char *buffer, const jsmntok_t *params)
{ {
struct chain_topology *topo = cmd->ld->topology; struct chain_topology *topo = cmd->ld->topology;
struct json_result *response; struct json_stream *response;
u32 feerates[NUM_FEERATES]; u32 feerates[NUM_FEERATES];
bool missing; bool missing;
enum feerate_style *style; enum feerate_style *style;

2
lightningd/connect_control.c

@ -65,7 +65,7 @@ static struct connect *find_connect(struct lightningd *ld,
static void connect_cmd_succeed(struct command *cmd, const struct pubkey *id) 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_object_start(response, NULL);
json_add_pubkey(response, "id", id); json_add_pubkey(response, "id", id);
json_object_end(response); json_object_end(response);

12
lightningd/gossip_control.c

@ -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 */ /* 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 char *fieldname,
const u8 raw_pubkey[sizeof(struct pubkey)]) 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 command *cmd)
{ {
struct gossip_getnodes_entry **nodes; struct gossip_getnodes_entry **nodes;
struct json_result *response; struct json_stream *response;
size_t i, j; size_t i, j;
if (!fromwire_gossip_getnodes_reply(reply, reply, &nodes)) { 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, static void json_getroute_reply(struct subd *gossip UNUSED, const u8 *reply, const int *fds UNUSED,
struct command *cmd) struct command *cmd)
{ {
struct json_result *response; struct json_stream *response;
struct route_hop *hops; struct route_hop *hops;
fromwire_gossip_getroute_reply(reply, reply, &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; size_t i;
struct gossip_getchannels_entry *entries; struct gossip_getchannels_entry *entries;
struct json_result *response; struct json_stream *response;
if (!fromwire_gossip_getchannels_reply(reply, reply, &entries)) { if (!fromwire_gossip_getchannels_reply(reply, reply, &entries)) {
command_fail(cmd, LIGHTNINGD, "Invalid reply from gossipd"); 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) const int *fds UNUSED, struct command *cmd)
{ {
bool ok, complete; bool ok, complete;
struct json_result *response; struct json_stream *response;
if (!fromwire_gossip_scids_reply(reply, &ok, &complete)) { if (!fromwire_gossip_scids_reply(reply, &ok, &complete)) {
command_fail(cmd, LIGHTNINGD, 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, static void json_channel_range_reply(struct subd *gossip UNUSED, const u8 *reply,
const int *fds UNUSED, struct command *cmd) const int *fds UNUSED, struct command *cmd)
{ {
struct json_result *response; struct json_stream *response;
u32 final_first_block, final_num_blocks; u32 final_first_block, final_num_blocks;
bool final_complete; bool final_complete;
struct short_channel_id *scids; struct short_channel_id *scids;

16
lightningd/invoice.c

@ -37,7 +37,7 @@ static const char *invoice_status_str(const struct invoice_details *inv)
return "unpaid"; 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) const struct invoice_details *inv)
{ {
json_object_start(response, NULL); 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) static void tell_waiter(struct command *cmd, const struct invoice *inv)
{ {
struct json_result *response; struct json_stream *response;
const struct invoice_details *details; const struct invoice_details *details;
details = wallet_invoice_details(cmd, cmd->ld->wallet, *inv); 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, const int *fs,
struct invoice_info *info) struct invoice_info *info)
{ {
struct json_result *response; struct json_stream *response;
struct route_info *inchans; struct route_info *inchans;
bool any_offline; bool any_offline;
struct invoice invoice; struct invoice invoice;
@ -390,7 +390,7 @@ static const struct json_command invoice_command = {
"(default autogenerated)"}; "(default autogenerated)"};
AUTODATA(json_command, &invoice_command); 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, struct wallet *wallet,
const struct json_escaped *label) const struct json_escaped *label)
{ {
@ -418,7 +418,7 @@ static void json_listinvoices(struct command *cmd,
const char *buffer, const jsmntok_t *params) const char *buffer, const jsmntok_t *params)
{ {
struct json_escaped *label; struct json_escaped *label;
struct json_result *response; struct json_stream *response;
struct wallet *wallet = cmd->ld->wallet; struct wallet *wallet = cmd->ld->wallet;
if (!param(cmd, buffer, params, if (!param(cmd, buffer, params,
p_opt("label", json_tok_label, &label), p_opt("label", json_tok_label, &label),
@ -445,7 +445,7 @@ static void json_delinvoice(struct command *cmd,
{ {
struct invoice i; struct invoice i;
const struct invoice_details *details; const struct invoice_details *details;
struct json_result *response; struct json_stream *response;
const char *status, *actual_status; const char *status, *actual_status;
struct json_escaped *label; struct json_escaped *label;
struct wallet *wallet = cmd->ld->wallet; struct wallet *wallet = cmd->ld->wallet;
@ -612,7 +612,7 @@ static const struct json_command waitinvoice_command = {
}; };
AUTODATA(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 char *fieldname,
const u8 *fallback, const u8 *fallback,
const struct chainparams *chain) const struct chainparams *chain)
@ -651,7 +651,7 @@ static void json_decodepay(struct command *cmd,
const char *buffer, const jsmntok_t *params) const char *buffer, const jsmntok_t *params)
{ {
struct bolt11 *b11; struct bolt11 *b11;
struct json_result *response; struct json_stream *response;
const char *str, *desc; const char *str, *desc;
char *fail; char *fail;

76
lightningd/json.c

@ -18,7 +18,7 @@
/* Output a route hop */ /* Output a route hop */
static void 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) const struct route_hop *h)
{ {
/* Imitate what getroute/sendpay use */ /* Imitate what getroute/sendpay use */
@ -33,7 +33,7 @@ json_add_route_hop(struct json_result *r, char const *n,
/* Output a route */ /* Output a route */
void 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) const struct route_hop *hops, size_t hops_len)
{ {
size_t i; size_t i;
@ -46,7 +46,7 @@ json_add_route(struct json_result *r, char const *n,
/* Outputs fields, not a separate object*/ /* Outputs fields, not a separate object*/
void void
json_add_payment_fields(struct json_result *response, json_add_payment_fields(struct json_stream *response,
const struct wallet_payment *t) const struct wallet_payment *t)
{ {
json_add_u64(response, "id", t->id); 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); 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 char *fieldname,
const struct pubkey *key) const struct pubkey *key)
{ {
@ -85,7 +85,7 @@ void json_add_pubkey(struct json_result *response,
json_add_hex(response, fieldname, der, sizeof(der)); 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) const struct bitcoin_txid *txid)
{ {
char hex[hex_str_size(sizeof(*txid))]; char hex[hex_str_size(sizeof(*txid))];
@ -284,7 +284,7 @@ bool json_tok_pubkey(struct command *cmd, const char *name,
return false; 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 char *fieldname,
const struct short_channel_id *id) const struct short_channel_id *id)
{ {
@ -405,7 +405,7 @@ json_tok_channel_id(const char *buffer, const jsmntok_t *tok,
cid, sizeof(*cid)); 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) const struct wireaddr *addr)
{ {
/* No need to print padding */ /* No need to print padding */
@ -436,7 +436,7 @@ void json_add_address(struct json_result *response, const char *fieldname,
json_object_end(response); 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 char *fieldname,
const struct wireaddr_internal *addr) const struct wireaddr_internal *addr)
{ {
@ -480,7 +480,7 @@ bool json_tok_tok(struct command *cmd, const char *name,
return (*out = tok); return (*out = tok);
} }
struct json_result { struct json_stream {
#if DEVELOPER #if DEVELOPER
/* tal_arr of types (JSMN_OBJECT/JSMN_ARRAY) we're enclosed in. */ /* tal_arr of types (JSMN_OBJECT/JSMN_ARRAY) we're enclosed in. */
jsmntype_t *wrapping; jsmntype_t *wrapping;
@ -495,7 +495,7 @@ struct json_result {
struct command *cmd; 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; 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) 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; struct json_connection *jcon = res->cmd->jcon;
va_list ap; va_list ap;
@ -521,7 +521,7 @@ result_append_fmt(struct json_result *res, const char *fmt, ...)
va_end(ap); va_end(ap);
} }
static void check_fieldname(const struct json_result *result, static void check_fieldname(const struct json_stream *result,
const char *fieldname) const char *fieldname)
{ {
#if DEVELOPER #if DEVELOPER
@ -538,7 +538,7 @@ static void check_fieldname(const struct json_result *result,
#endif #endif
} }
static void result_append_indent(struct json_result *result) static void result_append_indent(struct json_stream *result)
{ {
static const char indent_buf[] = " "; static const char indent_buf[] = " ";
size_t len; 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. */ /* Prepend comma if required. */
if (!result->empty) if (!result->empty)
@ -568,7 +568,7 @@ static void json_start_member(struct json_result *result, const char *fieldname)
result->empty = false; 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 #if DEVELOPER
*tal_arr_expand(&result->wrapping) = type; *tal_arr_expand(&result->wrapping) = type;
@ -577,7 +577,7 @@ static void result_indent(struct json_result *result, jsmntype_t type)
result->indent++; 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); assert(result->indent);
#if DEVELOPER #if DEVELOPER
@ -589,14 +589,14 @@ static void result_unindent(struct json_result *result, jsmntype_t type)
result->indent--; 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); json_start_member(result, fieldname);
result_append(result, "["); result_append(result, "[");
result_indent(result, JSMN_ARRAY); 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_append(result, "\n");
result_unindent(result, JSMN_ARRAY); result_unindent(result, JSMN_ARRAY);
@ -604,14 +604,14 @@ void json_array_end(struct json_result *result)
result_append(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); json_start_member(result, fieldname);
result_append(result, "{"); result_append(result, "{");
result_indent(result, JSMN_OBJECT); 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_append(result, "\n");
result_unindent(result, JSMN_OBJECT); result_unindent(result, JSMN_OBJECT);
@ -619,33 +619,33 @@ void json_object_end(struct json_result *result)
result_append(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); json_start_member(result, fieldname);
result_append_fmt(result, "%u", value); 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); json_start_member(result, fieldname);
result_append_fmt(result, "%f", value); 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) uint64_t value)
{ {
json_start_member(result, fieldname); json_start_member(result, fieldname);
result_append_fmt(result, "%"PRIu64, value); 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) const char *literal, int len)
{ {
json_start_member(result, fieldname); json_start_member(result, fieldname);
result_append_fmt(result, "%.*s", len, literal); 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); 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); 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); json_start_member(result, fieldname);
result_append(result, value ? "true" : "false"); 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) const void *data, size_t len)
{ {
char *hex = tal_arr(NULL, char, hex_str_size(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); 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 char *fieldname,
const tal_t *data) const tal_t *data)
{ {
json_add_hex(result, fieldname, data, tal_bytelen(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; va_list ap;
const char *field; const char *field;
@ -696,7 +696,7 @@ void json_add_object(struct json_result *result, ...)
va_end(ap); 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) const struct json_escaped *esc TAKES)
{ {
json_start_member(result, fieldname); json_start_member(result, fieldname);
@ -705,9 +705,9 @@ void json_add_escaped_string(struct json_result *result, const char *fieldname,
tal_free(esc); 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; r->cmd = cmd;
#if DEVELOPER #if DEVELOPER
@ -721,19 +721,19 @@ static struct json_result *new_json_stream(struct command *cmd)
return r; 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); r = new_json_stream(cmd);
result_append(r, "\"result\" : "); result_append(r, "\"result\" : ");
return r; return r;
} }
struct json_result *json_stream_fail_nodata(struct command *cmd, struct json_stream *json_stream_fail_nodata(struct command *cmd,
int code, int code,
const char *errmsg) const char *errmsg)
{ {
struct json_result *r = new_json_stream(cmd); struct json_stream *r = new_json_stream(cmd);
assert(code); assert(code);
assert(errmsg); assert(errmsg);
@ -744,11 +744,11 @@ struct json_result *json_stream_fail_nodata(struct command *cmd,
return r; return r;
} }
struct json_result *json_stream_fail(struct command *cmd, struct json_stream *json_stream_fail(struct command *cmd,
int code, int code,
const char *errmsg) 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\" : "); result_append(r, ", \"data\" : ");
return r; return r;

50
lightningd/json.h

@ -18,7 +18,7 @@ struct bitcoin_txid;
struct channel_id; struct channel_id;
struct command; struct command;
struct json_escaped; struct json_escaped;
struct json_result; struct json_stream;
struct pubkey; struct pubkey;
struct route_hop; struct route_hop;
struct sha256; struct sha256;
@ -28,21 +28,21 @@ struct wireaddr;
struct wireaddr_internal; struct wireaddr_internal;
/* Output a route array. */ /* 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); const struct route_hop *hops, size_t hops_len);
/* Output the fields of a wallet payment. /* Output the fields of a wallet payment.
* Should be used within an object context. */ * 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); const struct wallet_payment *t);
/* '"fieldname" : "0289abcdef..."' or "0289abcdef..." if fieldname is NULL */ /* '"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 char *fieldname,
const struct pubkey *key); const struct pubkey *key);
/* '"fieldname" : <hexrev>' or "<hexrev>" if fieldname is NULL */ /* '"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); const struct bitcoin_txid *txid);
/* Extract json array token */ /* Extract json array token */
@ -134,7 +134,7 @@ bool json_tok_feerate(struct command *cmd, const char *name,
u32 **feerate); u32 **feerate);
/* '"fieldname" : "1234:5:6"' */ /* '"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 char *fieldname,
const struct short_channel_id *id); 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); struct channel_id *cid);
/* JSON serialize a network address for a node */ /* 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); const struct wireaddr *addr);
/* JSON serialize a network address for a node. */ /* 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 char *fieldname,
const struct wireaddr_internal *addr); const struct wireaddr_internal *addr);
@ -162,13 +162,13 @@ bool json_tok_tok(struct command *cmd, const char *name,
/* Creating JSON output */ /* Creating JSON output */
/* '"fieldname" : [ ' or '[ ' if fieldname is NULL */ /* '"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 */ /* '"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. * 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. * The returned value should go to command_success() when done.
* json_add_* will be placed into the 'result' field of the JSON reply. * 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. * 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; * The returned value should go to command_failed() when done;
* json_add_* will be placed into the 'data' field of the 'error' JSON reply. * 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, int code,
const char *errmsg); 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. * 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, int code,
const char *errmsg); const char *errmsg);
/* '"fieldname" : "value"' or '"value"' if fieldname is NULL. Turns /* '"fieldname" : "value"' or '"value"' if fieldname is NULL. Turns
* any non-printable chars into JSON escapes, but leaves existing escapes alone. * 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 /* '"fieldname" : "value"' or '"value"' if fieldname is NULL. String must
* already be JSON escaped as necessary. */ * 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 char *fieldname,
const struct json_escaped *esc TAKES); const struct json_escaped *esc TAKES);
/* '"fieldname" : literal' or 'literal' if fieldname is NULL*/ /* '"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); const char *literal, int len);
/* '"fieldname" : value' or 'value' if fieldname is NULL */ /* '"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); double value);
/* '"fieldname" : value' or 'value' if fieldname is NULL */ /* '"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); unsigned int value);
/* '"fieldname" : value' or 'value' if fieldname is NULL */ /* '"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); uint64_t value);
/* '"fieldname" : true|false' or 'true|false' if fieldname is NULL */ /* '"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); bool value);
/* '"fieldname" : "0189abcdef..."' or "0189abcdef..." if fieldname is NULL */ /* '"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); const void *data, size_t len);
/* '"fieldname" : "0189abcdef..."' or "0189abcdef..." if fieldname is NULL */ /* '"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 char *fieldname,
const tal_t *data); 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 */ #endif /* LIGHTNING_LIGHTNINGD_JSON_H */

20
lightningd/jsonrpc.c

@ -80,7 +80,7 @@ AUTODATA(json_command, &help_command);
static void json_stop(struct command *cmd, static void json_stop(struct command *cmd,
const char *buffer UNUSED, const jsmntok_t *params UNUSED) const char *buffer UNUSED, const jsmntok_t *params UNUSED)
{ {
struct json_result *response; struct json_stream *response;
if (!param(cmd, buffer, params, NULL)) if (!param(cmd, buffer, params, NULL))
return; return;
@ -103,7 +103,7 @@ AUTODATA(json_command, &stop_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)
{ {
struct json_result *response; struct json_stream *response;
struct sha256 *secret; struct sha256 *secret;
if (!param(cmd, buffer, params, if (!param(cmd, buffer, params,
@ -147,7 +147,7 @@ AUTODATA(json_command, &dev_crash_command);
static void json_getinfo(struct command *cmd, static void json_getinfo(struct command *cmd,
const char *buffer UNUSED, const jsmntok_t *params UNUSED) const char *buffer UNUSED, const jsmntok_t *params UNUSED)
{ {
struct json_result *response; struct json_stream *response;
if (!param(cmd, buffer, params, NULL)) if (!param(cmd, buffer, params, NULL))
return; return;
@ -199,7 +199,7 @@ static struct json_command **get_cmdlist(void)
} }
static void json_add_help_command(struct command *cmd, static void json_add_help_command(struct command *cmd,
struct json_result *response, struct json_stream *response,
struct json_command *json_command) struct json_command *json_command)
{ {
char *usage; char *usage;
@ -232,7 +232,7 @@ 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; struct json_stream *response;
struct json_command **cmdlist = get_cmdlist(); struct json_command **cmdlist = get_cmdlist();
const jsmntok_t *cmdtok; 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); 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); response = json_stream_success(cmd);
json_object_start(response, NULL); json_object_start(response, NULL);
@ -358,7 +358,7 @@ static void destroy_command(struct command *cmd)
} }
/* FIXME: Remove result arg here! */ /* 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);
assert(cmd->have_json_stream); assert(cmd->have_json_stream);
@ -370,7 +370,7 @@ void command_success(struct command *cmd, struct json_result *result)
} }
/* FIXME: Remove result arg here! */ /* 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); assert(cmd->have_json_stream);
/* Have to close error */ /* 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 *fmt, ...)
{ {
const char *errmsg; const char *errmsg;
struct json_result *r; struct json_stream *r;
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);

6
lightningd/jsonrpc.h

@ -85,9 +85,9 @@ struct json_command {
const char *verbose; const char *verbose;
}; };
struct json_result *null_response(struct command *cmd); struct json_stream *null_response(struct command *cmd);
void command_success(struct command *cmd, struct json_result *response); void command_success(struct command *cmd, struct json_stream *response);
void command_failed(struct command *cmd, struct json_result *result); void command_failed(struct command *cmd, struct json_stream *result);
void PRINTF_FMT(3, 4) command_fail(struct command *cmd, int code, void PRINTF_FMT(3, 4) command_fail(struct command *cmd, int code,
const char *fmt, ...); const char *fmt, ...);

8
lightningd/log.c

@ -616,7 +616,7 @@ void fatal(const char *fmt, ...)
struct log_info { struct log_info {
enum log_level level; enum log_level level;
struct json_result *response; struct json_stream *response;
unsigned int num_skipped; 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) struct timespec ts)
{ {
char timebuf[100]; char timebuf[100];
@ -677,7 +677,7 @@ static void log_to_json(unsigned int skipped,
json_object_end(info->response); 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) const struct log_book *lr, enum log_level minlevel)
{ {
struct log_info info; 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, static void json_getlog(struct command *cmd,
const char *buffer, const jsmntok_t * params) const char *buffer, const jsmntok_t * params)
{ {
struct json_result *response; struct json_stream *response;
enum log_level *minlevel; enum log_level *minlevel;
struct log_book *lr = cmd->ld->log_book; struct log_book *lr = cmd->ld->log_book;

4
lightningd/log.h

@ -10,7 +10,7 @@
#include <stdarg.h> #include <stdarg.h>
struct command; struct command;
struct json_result; struct json_stream;
struct lightningd; struct lightningd;
struct timerel; struct timerel;
@ -100,7 +100,7 @@ void log_backtrace_print(const char *fmt, ...);
void log_backtrace_exit(void); void log_backtrace_exit(void);
/* Adds an array showing log entries */ /* 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); const struct log_book *lr, enum log_level minlevel);
bool json_tok_loglevel(struct command *cmd, const char *name, bool json_tok_loglevel(struct command *cmd, const char *name,

14
lightningd/memdump.c

@ -13,7 +13,7 @@
#include <lightningd/param.h> #include <lightningd/param.h>
#include <stdio.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) const void *ptr)
{ {
char ptrstr[STR_MAX_CHARS(void *)]; 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); 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, const char *name, const tal_t *root,
struct command *cmd) struct command *cmd)
{ {
@ -56,7 +56,7 @@ static void json_memdump(struct command *cmd,
const char *buffer UNNEEDED, const char *buffer UNNEEDED,
const jsmntok_t *params UNNEEDED) const jsmntok_t *params UNNEEDED)
{ {
struct json_result *response; struct json_stream *response;
if (!param(cmd, buffer, params, NULL)) if (!param(cmd, buffer, params, NULL))
return; return;
@ -78,7 +78,7 @@ static int json_add_syminfo(void *data, uintptr_t pc UNUSED,
const char *filename, int lineno, const char *filename, int lineno,
const char *function) const char *function)
{ {
struct json_result *response = data; struct json_stream *response = data;
char *str; char *str;
/* This can happen in backtraces. */ /* This can happen in backtraces. */
@ -91,7 +91,7 @@ static int json_add_syminfo(void *data, uintptr_t pc UNUSED,
return 0; return 0;
} }
static void json_add_backtrace(struct json_result *response, static void json_add_backtrace(struct json_stream *response,
const uintptr_t *bt) const uintptr_t *bt)
{ {
size_t i; size_t i;
@ -110,7 +110,7 @@ static void json_add_backtrace(struct json_result *response,
} }
static void scan_mem(struct command *cmd, static void scan_mem(struct command *cmd,
struct json_result *response, struct json_stream *response,
struct lightningd *ld) struct lightningd *ld)
{ {
struct htable *memtable; struct htable *memtable;
@ -154,7 +154,7 @@ static void json_memleak(struct command *cmd,
const char *buffer UNNEEDED, const char *buffer UNNEEDED,
const jsmntok_t *params UNNEEDED) const jsmntok_t *params UNNEEDED)
{ {
struct json_result *response; struct json_stream *response;
if (!param(cmd, buffer, params, NULL)) if (!param(cmd, buffer, params, NULL))
return; return;

4
lightningd/opening_control.c

@ -99,7 +99,7 @@ void kill_uncommitted_channel(struct uncommitted_channel *uc,
tal_free(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) const struct uncommitted_channel *uc)
{ {
u64 msatoshi_total, our_msatoshi; u64 msatoshi_total, our_msatoshi;
@ -236,7 +236,7 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp,
u32 feerate; u32 feerate;
u64 change_satoshi; u64 change_satoshi;
struct channel *channel; struct channel *channel;
struct json_result *response; struct json_stream *response;
struct lightningd *ld = openingd->ld; struct lightningd *ld = openingd->ld;
struct channel_id cid; struct channel_id cid;

4
lightningd/opening_control.h

@ -5,11 +5,11 @@
struct channel_id; struct channel_id;
struct crypto_state; struct crypto_state;
struct json_result; struct json_stream;
struct lightningd; struct lightningd;
struct uncommitted_channel; 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); const struct uncommitted_channel *uc);
void peer_start_openingd(struct peer *peer, void peer_start_openingd(struct peer *peer,

6
lightningd/options.c

@ -856,7 +856,7 @@ static const char *next_name(const char *names, unsigned *len)
return first_name(names + 1, 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 char *name0,
const struct wireaddr_internal *wireaddrs, const struct wireaddr_internal *wireaddrs,
const enum addr_listen_announce *listen_announce, 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, static void add_config(struct lightningd *ld,
struct json_result *response, struct json_stream *response,
const struct opt_table *opt, const struct opt_table *opt,
const char *name, size_t len) const char *name, size_t len)
{ {
@ -978,7 +978,7 @@ static void json_listconfigs(struct command *cmd,
const char *buffer, const jsmntok_t *params) const char *buffer, const jsmntok_t *params)
{ {
size_t i; size_t i;
struct json_result *response = NULL; struct json_stream *response = NULL;
const jsmntok_t *configtok; const jsmntok_t *configtok;
if (!param(cmd, buffer, params, if (!param(cmd, buffer, params,

8
lightningd/pay.c

@ -847,7 +847,7 @@ static void
json_sendpay_success(struct command *cmd, json_sendpay_success(struct command *cmd,
const struct sendpay_result *r) const struct sendpay_result *r)
{ {
struct json_result *response; struct json_stream *response;
assert(r->payment->status == PAYMENT_COMPLETE); assert(r->payment->status == PAYMENT_COMPLETE);
@ -869,7 +869,7 @@ static void json_waitsendpay_on_resolve(const struct sendpay_result *r,
if (r->succeeded) if (r->succeeded)
json_sendpay_success(cmd, r); json_sendpay_success(cmd, r);
else { else {
struct json_result *data; struct json_stream *data;
switch (r->errorcode) { switch (r->errorcode) {
/* We will never handle this case */ /* We will never handle this case */
case PAY_IN_PROGRESS: 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) { if (!r->succeeded && r->errorcode == PAY_IN_PROGRESS) {
/* This is normal for sendpay. Succeed. */ /* 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_object_start(response, NULL);
json_add_string(response, "message", json_add_string(response, "message",
"Monitor status with listpayments or waitsendpay"); "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 jsmntok_t *params)
{ {
const struct wallet_payment **payments; const struct wallet_payment **payments;
struct json_result *response; struct json_stream *response;
struct sha256 *rhash; struct sha256 *rhash;
const char *b11str; const char *b11str;

4
lightningd/pay.h

@ -7,7 +7,7 @@
#include <wire/gen_onion_wire.h> #include <wire/gen_onion_wire.h>
struct htlc_out; struct htlc_out;
struct json_result; struct json_stream;
struct lightningd; struct lightningd;
struct route_hop; struct route_hop;
struct sha256; 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 /* Output the fields of a payment. Caller should have put the
* response within a JSON object and is responsible for * response within a JSON object and is responsible for
* closing the object. */ * 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); const struct wallet_payment *t);
#endif /* LIGHTNING_LIGHTNINGD_PAY_H */ #endif /* LIGHTNING_LIGHTNINGD_PAY_H */

12
lightningd/payalgo.c

@ -47,7 +47,7 @@ struct pay_failure {
/* Output a pay failure */ /* Output a pay failure */
static void 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) const struct pay_failure *f)
{ {
struct routing_failure *rf; struct routing_failure *rf;
@ -78,7 +78,7 @@ json_add_failure(struct json_result *r, char const *n,
/* Output an array of payment failures. */ /* Output an array of payment failures. */
static void 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) const struct list_head *fs)
{ {
struct pay_failure *f; struct pay_failure *f;
@ -194,7 +194,7 @@ json_pay_success(struct pay *pay,
const struct sendpay_result *r) const struct sendpay_result *r)
{ {
struct command *cmd = pay->cmd; struct command *cmd = pay->cmd;
struct json_result *response; struct json_stream *response;
response = json_stream_success(cmd); response = json_stream_success(cmd);
json_object_start(response, NULL); json_object_start(response, NULL);
@ -211,7 +211,7 @@ json_pay_success(struct pay *pay,
static void json_pay_failure(struct pay *pay, static void json_pay_failure(struct pay *pay,
const struct sendpay_result *r) const struct sendpay_result *r)
{ {
struct json_result *data; struct json_stream *data;
struct routing_failure *fail; struct routing_failure *fail;
assert(!r->succeeded); assert(!r->succeeded);
@ -409,7 +409,7 @@ static void json_pay_getroute_reply(struct subd *gossip UNUSED,
double feepercent; double feepercent;
bool fee_too_high; bool fee_too_high;
bool delay_too_high; bool delay_too_high;
struct json_result *data; struct json_stream *data;
char const *err; char const *err;
fromwire_gossip_getroute_reply(reply, reply, &route); 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 too late anyway, fail now. */
if (time_after(now, pay->expiry)) { if (time_after(now, pay->expiry)) {
struct json_result *data struct json_stream *data
= json_stream_fail(cmd, PAY_INVOICE_EXPIRED, = json_stream_fail(cmd, PAY_INVOICE_EXPIRED,
"Invoice expired"); "Invoice expired");
json_object_start(data, NULL); json_object_start(data, NULL);

12
lightningd/peer_control.c

@ -232,7 +232,7 @@ static void remove_sig(struct bitcoin_tx *signed_tx)
static void static void
resolve_one_close_command(struct close_command *cc, bool cooperative) 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); u8 *tx = linearize_tx(result, cc->channel->last_tx);
struct bitcoin_txid txid; 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, static void json_add_htlcs(struct lightningd *ld,
struct json_result *response, struct json_stream *response,
const struct channel *channel) const struct channel *channel)
{ {
/* FIXME: make per-channel htlc maps! */ /* 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, static void json_add_peer(struct lightningd *ld,
struct json_result *response, struct json_stream *response,
struct peer *p, struct peer *p,
const enum log_level *ll) const enum log_level *ll)
{ {
@ -818,7 +818,7 @@ static void json_listpeers(struct command *cmd,
enum log_level *ll; enum log_level *ll;
struct pubkey *specific_id; struct pubkey *specific_id;
struct peer *peer; struct peer *peer;
struct json_result *response; struct json_stream *response;
if (!param(cmd, buffer, params, if (!param(cmd, buffer, params,
p_opt("id", json_tok_pubkey, &specific_id), 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 pubkey *peerid;
struct peer *peer; struct peer *peer;
struct json_result *response; struct json_stream *response;
u8 *linear; u8 *linear;
struct channel *channel; struct channel *channel;
@ -1233,7 +1233,7 @@ static void process_dev_forget_channel(struct bitcoind *bitcoind UNUSED,
const struct bitcoin_tx_output *txout, const struct bitcoin_tx_output *txout,
void *arg) void *arg)
{ {
struct json_result *response; struct json_stream *response;
struct dev_forget_channel_cmd *forget = arg; struct dev_forget_channel_cmd *forget = arg;
if (txout != NULL && !forget->force) { if (txout != NULL && !forget->force) {
command_fail(forget->cmd, LIGHTNINGD, command_fail(forget->cmd, LIGHTNINGD,

2
lightningd/ping.c

@ -69,7 +69,7 @@ void ping_reply(struct subd *subd, const u8 *msg)
else if (!sent) else if (!sent)
command_fail(pc->cmd, LIGHTNINGD, "Unknown peer"); command_fail(pc->cmd, LIGHTNINGD, "Unknown peer");
else { 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_object_start(response, NULL);
json_add_num(response, "totlen", totlen); json_add_num(response, "totlen", totlen);

42
lightningd/test/run-invoice-select-inchan.c

@ -49,13 +49,13 @@ void command_fail(struct command *cmd UNNEEDED, int code UNNEEDED,
const char *fmt UNNEEDED, ...) const char *fmt UNNEEDED, ...)
{ fprintf(stderr, "command_fail called!\n"); abort(); } { fprintf(stderr, "command_fail called!\n"); abort(); }
/* Generated stub for command_failed */ /* 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(); } { fprintf(stderr, "command_failed called!\n"); abort(); }
/* Generated stub for command_still_pending */ /* Generated stub for command_still_pending */
void command_still_pending(struct command *cmd UNNEEDED) void command_still_pending(struct command *cmd UNNEEDED)
{ fprintf(stderr, "command_still_pending called!\n"); abort(); } { fprintf(stderr, "command_still_pending called!\n"); abort(); }
/* Generated stub for command_success */ /* 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(); } { fprintf(stderr, "command_success called!\n"); abort(); }
/* Generated stub for connect_succeeded */ /* Generated stub for connect_succeeded */
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct pubkey *id UNNEEDED) 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) struct htlc_out_map *htlcs_out UNNEEDED)
{ fprintf(stderr, "htlcs_reconnect called!\n"); abort(); } { fprintf(stderr, "htlcs_reconnect called!\n"); abort(); }
/* Generated stub for json_add_bool */ /* 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) bool value UNNEEDED)
{ fprintf(stderr, "json_add_bool called!\n"); abort(); } { fprintf(stderr, "json_add_bool called!\n"); abort(); }
/* Generated stub for json_add_escaped_string */ /* 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 char *fieldname UNNEEDED,
const struct json_escaped *esc TAKES UNNEEDED) const struct json_escaped *esc TAKES UNNEEDED)
{ fprintf(stderr, "json_add_escaped_string called!\n"); abort(); } { fprintf(stderr, "json_add_escaped_string called!\n"); abort(); }
/* Generated stub for json_add_hex */ /* 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) const void *data UNNEEDED, size_t len UNNEEDED)
{ fprintf(stderr, "json_add_hex called!\n"); abort(); } { fprintf(stderr, "json_add_hex called!\n"); abort(); }
/* Generated stub for json_add_hex_talarr */ /* 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 char *fieldname UNNEEDED,
const tal_t *data UNNEEDED) const tal_t *data UNNEEDED)
{ fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); } { fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); }
/* Generated stub for json_add_log */ /* 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) const struct log_book *lr UNNEEDED, enum log_level minlevel UNNEEDED)
{ fprintf(stderr, "json_add_log called!\n"); abort(); } { fprintf(stderr, "json_add_log called!\n"); abort(); }
/* Generated stub for json_add_num */ /* 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) unsigned int value UNNEEDED)
{ fprintf(stderr, "json_add_num called!\n"); abort(); } { fprintf(stderr, "json_add_num called!\n"); abort(); }
/* Generated stub for json_add_pubkey */ /* 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 char *fieldname UNNEEDED,
const struct pubkey *key UNNEEDED) const struct pubkey *key UNNEEDED)
{ fprintf(stderr, "json_add_pubkey called!\n"); abort(); } { fprintf(stderr, "json_add_pubkey called!\n"); abort(); }
/* Generated stub for json_add_short_channel_id */ /* 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 char *fieldname UNNEEDED,
const struct short_channel_id *id UNNEEDED) const struct short_channel_id *id UNNEEDED)
{ fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); } { fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); }
/* Generated stub for json_add_string */ /* 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(); } { fprintf(stderr, "json_add_string called!\n"); abort(); }
/* Generated stub for json_add_txid */ /* 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) const struct bitcoin_txid *txid UNNEEDED)
{ fprintf(stderr, "json_add_txid called!\n"); abort(); } { fprintf(stderr, "json_add_txid called!\n"); abort(); }
/* Generated stub for json_add_u64 */ /* 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) uint64_t value UNNEEDED)
{ fprintf(stderr, "json_add_u64 called!\n"); abort(); } { fprintf(stderr, "json_add_u64 called!\n"); abort(); }
/* Generated stub for json_add_uncommitted_channel */ /* 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) const struct uncommitted_channel *uc UNNEEDED)
{ fprintf(stderr, "json_add_uncommitted_channel called!\n"); abort(); } { fprintf(stderr, "json_add_uncommitted_channel called!\n"); abort(); }
/* Generated stub for json_array_end */ /* 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(); } { fprintf(stderr, "json_array_end called!\n"); abort(); }
/* Generated stub for json_array_start */ /* 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(); } { fprintf(stderr, "json_array_start called!\n"); abort(); }
/* Generated stub for json_escape */ /* Generated stub for json_escape */
struct json_escaped *json_escape(const tal_t *ctx UNNEEDED, const char *str TAKES UNNEEDED) struct json_escaped *json_escape(const tal_t *ctx UNNEEDED, const char *str TAKES UNNEEDED)
{ fprintf(stderr, "json_escape called!\n"); abort(); } { fprintf(stderr, "json_escape called!\n"); abort(); }
/* Generated stub for json_object_end */ /* 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(); } { fprintf(stderr, "json_object_end called!\n"); abort(); }
/* Generated stub for json_object_start */ /* 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(); } { fprintf(stderr, "json_object_start called!\n"); abort(); }
/* Generated stub for json_stream_fail */ /* 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, int code UNNEEDED,
const char *errmsg UNNEEDED) const char *errmsg UNNEEDED)
{ fprintf(stderr, "json_stream_fail called!\n"); abort(); } { fprintf(stderr, "json_stream_fail called!\n"); abort(); }
/* Generated stub for json_stream_success */ /* 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(); } { fprintf(stderr, "json_stream_success called!\n"); abort(); }
/* Generated stub for json_tok_address_scriptpubkey */ /* Generated stub for json_tok_address_scriptpubkey */
enum address_parse_result json_tok_address_scriptpubkey(const tal_t *ctx UNNEEDED, 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) void (*cb)(void *) UNNEEDED, void *arg UNNEEDED)
{ fprintf(stderr, "new_reltimer_ called!\n"); abort(); } { fprintf(stderr, "new_reltimer_ called!\n"); abort(); }
/* Generated stub for null_response */ /* 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(); } { fprintf(stderr, "null_response called!\n"); abort(); }
/* Generated stub for onchaind_funding_spent */ /* Generated stub for onchaind_funding_spent */
enum watch_result onchaind_funding_spent(struct channel *channel UNNEEDED, enum watch_result onchaind_funding_spent(struct channel *channel UNNEEDED,

4
lightningd/test/run-jsonrpc.c

@ -60,7 +60,7 @@ static int test_json_filter(void)
{ {
struct command *cmd = talz(NULL, struct command); struct command *cmd = talz(NULL, struct command);
struct json_connection *jcon = talz(cmd, struct json_connection); 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; jsmntok_t *toks;
const jsmntok_t *x; const jsmntok_t *x;
bool valid; bool valid;
@ -114,7 +114,7 @@ static void test_json_escape(void)
char badstr[2]; char badstr[2];
struct command *cmd = talz(NULL, struct command); struct command *cmd = talz(NULL, struct command);
struct json_connection *jcon = talz(cmd, struct json_connection); 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; struct json_escaped *esc;
badstr[0] = i; badstr[0] = i;

36
wallet/test/run-wallet.c

@ -58,7 +58,7 @@ void command_fail(struct command *cmd UNNEEDED, int code UNNEEDED,
void command_still_pending(struct command *cmd UNNEEDED) void command_still_pending(struct command *cmd UNNEEDED)
{ fprintf(stderr, "command_still_pending called!\n"); abort(); } { fprintf(stderr, "command_still_pending called!\n"); abort(); }
/* Generated stub for command_success */ /* 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(); } { fprintf(stderr, "command_success called!\n"); abort(); }
/* Generated stub for connect_succeeded */ /* Generated stub for connect_succeeded */
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct pubkey *id UNNEEDED) 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) void *cbarg UNNEEDED)
{ fprintf(stderr, "invoices_waitone called!\n"); abort(); } { fprintf(stderr, "invoices_waitone called!\n"); abort(); }
/* Generated stub for json_add_bool */ /* 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) bool value UNNEEDED)
{ fprintf(stderr, "json_add_bool called!\n"); abort(); } { fprintf(stderr, "json_add_bool called!\n"); abort(); }
/* Generated stub for json_add_hex */ /* 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) const void *data UNNEEDED, size_t len UNNEEDED)
{ fprintf(stderr, "json_add_hex called!\n"); abort(); } { fprintf(stderr, "json_add_hex called!\n"); abort(); }
/* Generated stub for json_add_hex_talarr */ /* 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 char *fieldname UNNEEDED,
const tal_t *data UNNEEDED) const tal_t *data UNNEEDED)
{ fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); } { fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); }
/* Generated stub for json_add_log */ /* 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) const struct log_book *lr UNNEEDED, enum log_level minlevel UNNEEDED)
{ fprintf(stderr, "json_add_log called!\n"); abort(); } { fprintf(stderr, "json_add_log called!\n"); abort(); }
/* Generated stub for json_add_num */ /* 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) unsigned int value UNNEEDED)
{ fprintf(stderr, "json_add_num called!\n"); abort(); } { fprintf(stderr, "json_add_num called!\n"); abort(); }
/* Generated stub for json_add_pubkey */ /* 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 char *fieldname UNNEEDED,
const struct pubkey *key UNNEEDED) const struct pubkey *key UNNEEDED)
{ fprintf(stderr, "json_add_pubkey called!\n"); abort(); } { fprintf(stderr, "json_add_pubkey called!\n"); abort(); }
/* Generated stub for json_add_short_channel_id */ /* 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 char *fieldname UNNEEDED,
const struct short_channel_id *id UNNEEDED) const struct short_channel_id *id UNNEEDED)
{ fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); } { fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); }
/* Generated stub for json_add_string */ /* 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(); } { fprintf(stderr, "json_add_string called!\n"); abort(); }
/* Generated stub for json_add_txid */ /* 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) const struct bitcoin_txid *txid UNNEEDED)
{ fprintf(stderr, "json_add_txid called!\n"); abort(); } { fprintf(stderr, "json_add_txid called!\n"); abort(); }
/* Generated stub for json_add_u64 */ /* 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) uint64_t value UNNEEDED)
{ fprintf(stderr, "json_add_u64 called!\n"); abort(); } { fprintf(stderr, "json_add_u64 called!\n"); abort(); }
/* Generated stub for json_add_uncommitted_channel */ /* 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) const struct uncommitted_channel *uc UNNEEDED)
{ fprintf(stderr, "json_add_uncommitted_channel called!\n"); abort(); } { fprintf(stderr, "json_add_uncommitted_channel called!\n"); abort(); }
/* Generated stub for json_array_end */ /* 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(); } { fprintf(stderr, "json_array_end called!\n"); abort(); }
/* Generated stub for json_array_start */ /* 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(); } { fprintf(stderr, "json_array_start called!\n"); abort(); }
/* Generated stub for json_escaped_string_ */ /* Generated stub for json_escaped_string_ */
struct json_escaped *json_escaped_string_(const tal_t *ctx UNNEEDED, struct json_escaped *json_escaped_string_(const tal_t *ctx UNNEEDED,
const void *bytes UNNEEDED, size_t len UNNEEDED) const void *bytes UNNEEDED, size_t len UNNEEDED)
{ fprintf(stderr, "json_escaped_string_ called!\n"); abort(); } { fprintf(stderr, "json_escaped_string_ called!\n"); abort(); }
/* Generated stub for json_object_end */ /* 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(); } { fprintf(stderr, "json_object_end called!\n"); abort(); }
/* Generated stub for json_object_start */ /* 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(); } { fprintf(stderr, "json_object_start called!\n"); abort(); }
/* Generated stub for json_stream_success */ /* 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(); } { fprintf(stderr, "json_stream_success called!\n"); abort(); }
/* Generated stub for json_tok_bool */ /* Generated stub for json_tok_bool */
bool json_tok_bool(struct command *cmd UNNEEDED, const char *name UNNEEDED, 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) const void *data UNNEEDED, size_t len UNNEEDED)
{ fprintf(stderr, "log_io called!\n"); abort(); } { fprintf(stderr, "log_io called!\n"); abort(); }
/* Generated stub for null_response */ /* 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(); } { fprintf(stderr, "null_response called!\n"); abort(); }
/* Generated stub for onchaind_funding_spent */ /* Generated stub for onchaind_funding_spent */
enum watch_result onchaind_funding_spent(struct channel *channel UNNEEDED, enum watch_result onchaind_funding_spent(struct channel *channel UNNEEDED,

12
wallet/walletrpc.c

@ -65,7 +65,7 @@ static void wallet_withdrawal_broadcast(struct bitcoind *bitcoind UNUSED,
* not if we're actually making a payment to ourselves! */ * not if we're actually making a payment to ourselves! */
assert(change_satoshi >= withdraw->wtx.change); 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_object_start(response, NULL);
json_add_string(response, "tx", withdraw->hextx); json_add_string(response, "tx", withdraw->hextx);
json_add_string(response, "txid", output); 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, static void json_newaddr(struct command *cmd, const char *buffer UNUSED,
const jsmntok_t *params UNUSED) const jsmntok_t *params UNUSED)
{ {
struct json_result *response; struct json_stream *response;
struct ext_key ext; struct ext_key ext;
struct pubkey pubkey; struct pubkey pubkey;
bool *is_p2wpkh; bool *is_p2wpkh;
@ -301,7 +301,7 @@ AUTODATA(json_command, &newaddr_command);
static void json_listaddrs(struct command *cmd, static void json_listaddrs(struct command *cmd,
const char *buffer, const jsmntok_t *params) const char *buffer, const jsmntok_t *params)
{ {
struct json_result *response; struct json_stream *response;
struct ext_key ext; struct ext_key ext;
struct pubkey pubkey; struct pubkey pubkey;
u64 *bip32_max_index; u64 *bip32_max_index;
@ -379,7 +379,7 @@ AUTODATA(json_command, &listaddrs_command);
static void json_listfunds(struct command *cmd, const char *buffer UNUSED, static void json_listfunds(struct command *cmd, const char *buffer UNUSED,
const jsmntok_t *params UNUSED) const jsmntok_t *params UNUSED)
{ {
struct json_result *response; struct json_stream *response;
struct peer *p; struct peer *p;
struct utxo **utxos; struct utxo **utxos;
char* out; char* out;
@ -464,7 +464,7 @@ AUTODATA(json_command, &listfunds_command);
struct txo_rescan { struct txo_rescan {
struct command *cmd; struct command *cmd;
struct utxo **utxos; struct utxo **utxos;
struct json_result *response; struct json_stream *response;
}; };
static void process_utxo_result(struct bitcoind *bitcoind, static void process_utxo_result(struct bitcoind *bitcoind,
@ -472,7 +472,7 @@ static void process_utxo_result(struct bitcoind *bitcoind,
void *arg) void *arg)
{ {
struct txo_rescan *rescan = arg; struct txo_rescan *rescan = arg;
struct json_result *response = rescan->response; struct json_stream *response = rescan->response;
struct utxo *u = rescan->utxos[0]; struct utxo *u = rescan->utxos[0];
enum output_status newstate = enum output_status newstate =
txout == NULL ? output_state_spent : output_state_available; txout == NULL ? output_state_spent : output_state_available;

Loading…
Cancel
Save