mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
openingd: Reject zeroconf if the peer is not allowed
We determine whether they are allowed or not based on the hook return value of `mindepth`. To do so we need to pass that value down to `openingd` and verify that the `channel_type` and our permissions match up.
This commit is contained in:
parent
6bc71796c8
commit
71a8e59acd
@ -725,7 +725,8 @@ openchannel_hook_final(struct openchannel_hook_payload *payload STEALS)
|
||||
take(towire_openingd_got_offer_reply(NULL, errmsg,
|
||||
our_upfront_shutdown_script,
|
||||
upfront_shutdown_script_wallet_index,
|
||||
payload->uc->reserve)));
|
||||
payload->uc->reserve,
|
||||
payload->uc->minimum_depth)));
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -1126,7 +1126,8 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
|
||||
if (!fromwire_openingd_got_offer_reply(state, msg, &err_reason,
|
||||
&state->upfront_shutdown_script[LOCAL],
|
||||
&state->local_upfront_shutdown_wallet_index,
|
||||
&reserve))
|
||||
&reserve,
|
||||
&state->minimum_depth))
|
||||
master_badmsg(WIRE_OPENINGD_GOT_OFFER_REPLY, msg);
|
||||
|
||||
/* If they give us a reason to reject, do so. */
|
||||
@ -1136,6 +1137,14 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (channel_type_has(state->channel_type, OPT_ZEROCONF) &&
|
||||
state->minimum_depth > 0) {
|
||||
negotiation_failed(
|
||||
state,
|
||||
"You required zeroconf, but you're not on our allowlist");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!state->upfront_shutdown_script[LOCAL])
|
||||
state->upfront_shutdown_script[LOCAL]
|
||||
= no_upfront_shutdown_script(state,
|
||||
|
@ -51,6 +51,7 @@ 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_wallet_index,?u32,
|
||||
msgdata,openingd_got_offer_reply,reserve,?amount_sat,
|
||||
msgdata,openingd_got_offer_reply,mindepth,u32,
|
||||
|
||||
#include <common/penalty_base.h>
|
||||
# Openingd->master: we've successfully offered channel.
|
||||
|
|
Loading…
Reference in New Issue
Block a user