mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 00:54:20 +01:00
dualopend: check that we're not exceeding max allowable capacity
This commit is contained in:
@@ -985,6 +985,23 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
|
|||||||
type_to_string(tmpctx, struct amount_sat,
|
type_to_string(tmpctx, struct amount_sat,
|
||||||
&state->opener_funding));
|
&state->opener_funding));
|
||||||
|
|
||||||
|
/* Check that total funding doesn't exceed allowed channel capacity */
|
||||||
|
/* BOLT #2:
|
||||||
|
*
|
||||||
|
* The receiving node MUST fail the channel if:
|
||||||
|
*...
|
||||||
|
* - `funding_satoshis` is greater than or equal to 2^24 and the receiver does not support
|
||||||
|
* `option_support_large_channel`. */
|
||||||
|
/* We choose to require *negotiation*, not just support! */
|
||||||
|
if (!feature_negotiated(state->our_features, state->their_features,
|
||||||
|
OPT_LARGE_CHANNELS)
|
||||||
|
&& amount_sat_greater(total, chainparams->max_funding)) {
|
||||||
|
negotiation_failed(state, false,
|
||||||
|
"total funding_satoshis %s too large",
|
||||||
|
type_to_string(tmpctx, struct amount_sat,
|
||||||
|
&total));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Add all of our inputs/outputs to the changeset */
|
/* Add all of our inputs/outputs to the changeset */
|
||||||
init_changeset(state, psbt);
|
init_changeset(state, psbt);
|
||||||
|
|||||||
Reference in New Issue
Block a user