mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
common/json_stream: make json_add_jsonstr take a length.
This is useful when have have a jsmntok_t. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -499,7 +499,8 @@ multifundchannel_finished(struct multifundchannel_command *mfc)
|
||||
mfc->removeds[i].error_message);
|
||||
if (mfc->removeds[i].error_data)
|
||||
json_add_jsonstr(out, "data",
|
||||
mfc->removeds[i].error_data);
|
||||
mfc->removeds[i].error_data,
|
||||
strlen(mfc->removeds[i].error_data));
|
||||
json_object_end(out); /* End error object */
|
||||
json_object_end(out);
|
||||
}
|
||||
@@ -1382,7 +1383,8 @@ perform_fundpsbt(struct multifundchannel_command *mfc, u32 feerate)
|
||||
&after_fundpsbt,
|
||||
&mfc_forward_error,
|
||||
mfc);
|
||||
json_add_jsonstr(req->js, "utxos", mfc->utxos_str);
|
||||
json_add_jsonstr(req->js, "utxos",
|
||||
mfc->utxos_str, strlen(mfc->utxos_str));
|
||||
json_add_bool(req->js, "reservedok", false);
|
||||
} else {
|
||||
plugin_log(mfc->cmd->plugin, LOG_DBG,
|
||||
@@ -1814,7 +1816,8 @@ post_cleanup_redo_multifundchannel(struct multifundchannel_redo *redo)
|
||||
json_add_string(out, "method", failing_method);
|
||||
if (mfc->removeds[i].error_data)
|
||||
json_add_jsonstr(out, "data",
|
||||
mfc->removeds[i].error_data);
|
||||
mfc->removeds[i].error_data,
|
||||
strlen(mfc->removeds[i].error_data));
|
||||
|
||||
/* Close 'data'. */
|
||||
json_object_end(out);
|
||||
|
||||
@@ -356,7 +356,7 @@ static struct command_result *start_mw(struct multiwithdraw_command *mw)
|
||||
&mw_forward_error,
|
||||
mw);
|
||||
json_add_bool(req->js, "reservedok", false);
|
||||
json_add_jsonstr(req->js, "utxos", mw->utxos);
|
||||
json_add_jsonstr(req->js, "utxos", mw->utxos, strlen(mw->utxos));
|
||||
} else {
|
||||
plugin_log(mw->cmd->plugin, LOG_DBG,
|
||||
"multiwithdraw %"PRIu64": fundpsbt.",
|
||||
|
||||
@@ -346,7 +346,9 @@ openchannel_finished(struct multifundchannel_command *mfc)
|
||||
json_add_node_id(out, "id", &dest->id);
|
||||
json_add_string(out, "method", "openchannel_signed");
|
||||
if (dest->error_data)
|
||||
json_add_jsonstr(out, "data", dest->error_data);
|
||||
json_add_jsonstr(out, "data",
|
||||
dest->error_data,
|
||||
strlen(dest->error_data));
|
||||
json_object_end(out);
|
||||
|
||||
return mfc_finished(mfc, out);
|
||||
|
||||
Reference in New Issue
Block a user