jsonrpc: Add mindepth argument to fundchannel and multifundchannel

This will eventually enable us to specify 0 for zeroconf channels.

Changelog-Added: JSON-RPC: Added `mindepth` argument to specify the number of confirmations we require for `fundchannel` and `multifundchannel`
This commit is contained in:
Christian Decker
2022-05-20 11:45:26 +02:00
parent 6d07f4ed85
commit 185cd81be4
10 changed files with 49 additions and 12 deletions

View File

@@ -44,6 +44,7 @@ json_fundchannel(struct command *cmd,
const jsmntok_t *close_to;
const jsmntok_t *request_amt;
const jsmntok_t *compact_lease;
const jsmntok_t *mindepth;
struct out_req *req;
@@ -58,6 +59,7 @@ json_fundchannel(struct command *cmd,
p_opt("close_to", param_tok, &close_to),
p_opt("request_amt", param_tok, &request_amt),
p_opt("compact_lease", param_tok, &compact_lease),
p_opt("mindepth", param_tok, &mindepth),
NULL))
return command_param_failed();
@@ -84,6 +86,10 @@ json_fundchannel(struct command *cmd,
json_add_tok(req->js, "request_amt", request_amt, buf);
json_add_tok(req->js, "compact_lease", compact_lease, buf);
}
if (mindepth)
json_add_tok(req->js, "mindepth", mindepth, buf);
json_object_end(req->js);
json_array_end(req->js);
if (feerate)

View File

@@ -1113,12 +1113,16 @@ fundchannel_start_dest(struct multifundchannel_destination *dest)
json_add_string(req->js, "feerate", mfc->cmtmt_feerate_str);
else if (mfc->feerate_str)
json_add_string(req->js, "feerate", mfc->feerate_str);
json_add_bool(req->js, "announce", dest->announce);
json_add_string(req->js, "push_msat",
fmt_amount_msat(tmpctx, dest->push_msat));
if (dest->close_to_str)
json_add_string(req->js, "close_to", dest->close_to_str);
if (dest->mindepth)
json_add_u32(req->js, "mindepth", *dest->mindepth);
send_outreq(cmd->plugin, req);
}
@@ -1890,6 +1894,7 @@ param_destinations_array(struct command *cmd, const char *name,
p_opt_def("request_amt", param_sat, &request_amt,
AMOUNT_SAT(0)),
p_opt("compact_lease", param_lease_hex, &rates),
p_opt("mindepth", param_u32, &dest->mindepth),
NULL))
return command_param_failed();

View File

@@ -149,6 +149,9 @@ struct multifundchannel_destination {
/* Channel lease rates that we expect the peer to respond with */
struct lease_rates *rates;
/* Number of blocks to wait before sending `channel_ready`. */
u32 *mindepth;
};