openingd: Wire reserve value through to openingd

This commit is contained in:
Christian Decker 2022-06-08 13:55:47 +02:00
parent 9a97f8c154
commit 8d6423389a
3 changed files with 12 additions and 3 deletions

View File

@ -711,7 +711,8 @@ openchannel_hook_final(struct openchannel_hook_payload *payload STEALS)
subd_send_msg(openingd, subd_send_msg(openingd,
take(towire_openingd_got_offer_reply(NULL, errmsg, take(towire_openingd_got_offer_reply(NULL, errmsg,
our_upfront_shutdown_script, our_upfront_shutdown_script,
upfront_shutdown_script_wallet_index))); upfront_shutdown_script_wallet_index,
payload->uc->reserve)));
} }
static bool static bool

View File

@ -814,6 +814,7 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
struct penalty_base *pbase; struct penalty_base *pbase;
struct tlv_accept_channel_tlvs *accept_tlvs; struct tlv_accept_channel_tlvs *accept_tlvs;
struct tlv_open_channel_tlvs *open_tlvs; struct tlv_open_channel_tlvs *open_tlvs;
struct amount_sat *reserve;
/* BOLT #2: /* BOLT #2:
* *
@ -1013,8 +1014,9 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
/* We don't allocate off tmpctx, because that's freed inside /* We don't allocate off tmpctx, because that's freed inside
* opening_negotiate_msg */ * opening_negotiate_msg */
if (!fromwire_openingd_got_offer_reply(state, msg, &err_reason, if (!fromwire_openingd_got_offer_reply(state, msg, &err_reason,
&state->upfront_shutdown_script[LOCAL], &state->upfront_shutdown_script[LOCAL],
&state->local_upfront_shutdown_wallet_index)) &state->local_upfront_shutdown_wallet_index,
&reserve))
master_badmsg(WIRE_OPENINGD_GOT_OFFER_REPLY, msg); master_badmsg(WIRE_OPENINGD_GOT_OFFER_REPLY, msg);
/* If they give us a reason to reject, do so. */ /* If they give us a reason to reject, do so. */
@ -1030,6 +1032,11 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
state->our_features, state->our_features,
state->their_features); state->their_features);
if (reserve != NULL) {
set_reserve_absolute(state, state->remoteconf.dust_limit,
*reserve);
}
/* OK, we accept! */ /* OK, we accept! */
accept_tlvs = tlv_accept_channel_tlvs_new(tmpctx); accept_tlvs = tlv_accept_channel_tlvs_new(tmpctx);
accept_tlvs->upfront_shutdown_script accept_tlvs->upfront_shutdown_script

View File

@ -46,6 +46,7 @@ msgdata,openingd_got_offer_reply,rejection,?wirestring,
msgdata,openingd_got_offer_reply,shutdown_len,u16, msgdata,openingd_got_offer_reply,shutdown_len,u16,
msgdata,openingd_got_offer_reply,our_shutdown_scriptpubkey,?u8,shutdown_len msgdata,openingd_got_offer_reply,our_shutdown_scriptpubkey,?u8,shutdown_len
msgdata,openingd_got_offer_reply,our_shutdown_wallet_index,?u32, msgdata,openingd_got_offer_reply,our_shutdown_wallet_index,?u32,
msgdata,openingd_got_offer_reply,reserve,?amount_sat,
#include <common/penalty_base.h> #include <common/penalty_base.h>
# Openingd->master: we've successfully offered channel. # Openingd->master: we've successfully offered channel.

1 #include <bitcoin/chainparams.h>
46 #include <common/penalty_base.h> msgdata,openingd_got_offer_reply,reserve,?amount_sat,
47 # Openingd->master: we've successfully offered channel. #include <common/penalty_base.h>
48 # This gives their sig, means we can broadcast tx: we're done. # Openingd->master: we've successfully offered channel.
49 # This gives their sig, means we can broadcast tx: we're done.
50 msgtype,openingd_funder_reply,6101
51 msgdata,openingd_funder_reply,their_config,channel_config,
52 msgdata,openingd_funder_reply,first_commit,bitcoin_tx,