mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
openingd: allow channel_type to *downgrade* from default.
e.g. you can negotiate anchor_outputs, but still ask for a non-anchor-output channel. If/when we make those features compulsory, downgrade will not be allowed. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
65290c02ba
commit
b985cd774d
1 changed files with 18 additions and 15 deletions
|
@ -832,27 +832,30 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
|
||||||
"Parsing open_channel %s", tal_hex(tmpctx, open_channel_msg));
|
"Parsing open_channel %s", tal_hex(tmpctx, open_channel_msg));
|
||||||
set_remote_upfront_shutdown(state, open_tlvs->upfront_shutdown_script);
|
set_remote_upfront_shutdown(state, open_tlvs->upfront_shutdown_script);
|
||||||
|
|
||||||
state->channel_type
|
|
||||||
= default_channel_type(state,
|
|
||||||
state->our_features, state->their_features);
|
|
||||||
|
|
||||||
/* BOLT-channel-types #2:
|
/* BOLT-channel-types #2:
|
||||||
* The receiving node MUST fail the channel if:
|
* The receiving node MUST fail the channel if:
|
||||||
*...
|
*...
|
||||||
* - It supports `channel_type`, `channel_type` was set, and the
|
* - It supports `channel_type`, `channel_type` was set, and the
|
||||||
* `type` is not suitable.
|
* `type` is not suitable.
|
||||||
*/
|
*/
|
||||||
|
if (open_tlvs->channel_type) {
|
||||||
/* FIXME: We in fact insist on the exact type we want! */
|
state->channel_type =
|
||||||
if (open_tlvs->channel_type
|
channel_type_accept(state,
|
||||||
&& !featurebits_eq(state->channel_type->features,
|
open_tlvs->channel_type,
|
||||||
open_tlvs->channel_type)) {
|
state->our_features,
|
||||||
negotiation_failed(state, false,
|
state->their_features);
|
||||||
"Did not support channel_type %s",
|
if (!state->channel_type) {
|
||||||
fmt_featurebits(tmpctx,
|
negotiation_failed(state, false,
|
||||||
open_tlvs->channel_type));
|
"Did not support channel_type %s",
|
||||||
return NULL;
|
fmt_featurebits(tmpctx,
|
||||||
}
|
open_tlvs->channel_type));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
state->channel_type
|
||||||
|
= default_channel_type(state,
|
||||||
|
state->our_features,
|
||||||
|
state->their_features);
|
||||||
|
|
||||||
/* BOLT #2:
|
/* BOLT #2:
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue