df: wire up peer's "require-confirmed-inputs"

We push this info out to the various RPCs/hooks.
This commit is contained in:
niftynei
2023-01-10 15:03:44 -06:00
committed by Alex Myers
parent f05d450098
commit 9f53e3c7f5
11 changed files with 51 additions and 7 deletions

View File

@@ -185,6 +185,7 @@ struct rbf_channel_payload {
struct amount_sat our_last_funding;
u32 funding_feerate_per_kw;
u32 locktime;
bool req_confirmed_ins;
/* General info */
u32 feerate_our_max;
@@ -228,6 +229,8 @@ static void rbf_channel_hook_serialize(struct rbf_channel_payload *payload,
if (payload->requested_lease_amt)
json_add_amount_sat_msat(stream, "requested_lease_msat",
*payload->requested_lease_amt);
json_add_bool(stream, "require_confirmed_inputs",
payload->req_confirmed_ins);
json_object_end(stream);
}
@@ -270,6 +273,7 @@ struct openchannel2_payload {
struct amount_sat *requested_lease_amt;
u32 lease_blockheight_start;
u32 node_blockheight;
bool req_confirmed_ins;
struct amount_sat accepter_funding;
struct wally_psbt *psbt;
@@ -319,6 +323,8 @@ static void openchannel2_hook_serialize(struct openchannel2_payload *payload,
json_add_num(stream, "node_blockheight",
payload->node_blockheight);
}
json_add_bool(stream, "require_confirmed_inputs",
payload->req_confirmed_ins);
json_object_end(stream);
}
@@ -339,6 +345,8 @@ openchannel2_changed_hook_serialize(struct openchannel2_psbt_payload *payload,
json_add_string(stream, "channel_id",
type_to_string(tmpctx, struct channel_id,
&payload->channel->cid));
json_add_bool(stream, "require_confirmed_inputs",
payload->channel->req_confirmed_ins);
json_object_end(stream);
}
@@ -692,6 +700,7 @@ openchannel2_hook_cb(struct openchannel2_payload *payload STEALS)
channel->cid = payload->channel_id;
channel->opener = REMOTE;
channel->open_attempt = new_channel_open_attempt(channel);
channel->req_confirmed_ins = payload->req_confirmed_ins;
msg = towire_dualopend_got_offer_reply(NULL,
payload->accepter_funding,
payload->psbt,
@@ -1876,6 +1885,7 @@ static void rbf_got_offer(struct subd *dualopend, const u8 *msg)
payload->peer_id = channel->peer->id;
payload->feerate_our_max = feerate_max(dualopend->ld, NULL);
payload->feerate_our_min = feerate_min(dualopend->ld, NULL);
payload->req_confirmed_ins = channel->req_confirmed_ins;
payload->psbt = NULL;
@@ -1930,7 +1940,8 @@ static void accepter_got_offer(struct subd *dualopend,
&payload->locktime,
&payload->shutdown_scriptpubkey,
&payload->requested_lease_amt,
&payload->lease_blockheight_start)) {
&payload->lease_blockheight_start,
&payload->req_confirmed_ins)) {
channel_internal_error(channel, "Bad DUALOPEND_GOT_OFFER: %s",
tal_hex(tmpctx, msg));
return;
@@ -2963,6 +2974,7 @@ static void handle_psbt_changed(struct subd *dualopend,
if (!fromwire_dualopend_psbt_changed(tmpctx, msg,
&cid,
&channel->req_confirmed_ins,
&funding_serial,
&psbt)) {
channel_internal_error(channel,
@@ -2990,6 +3002,8 @@ static void handle_psbt_changed(struct subd *dualopend,
json_add_psbt(response, "psbt", psbt);
json_add_bool(response, "commitments_secured", false);
json_add_u64(response, "funding_serial", funding_serial);
json_add_bool(response, "requires_confirmed_inputs",
channel->req_confirmed_ins);
oa->cmd = NULL;
was_pending(command_success(cmd, response));