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));
|
||||
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:
|
||||
* The receiving node MUST fail the channel if:
|
||||
*...
|
||||
* - It supports `channel_type`, `channel_type` was set, and the
|
||||
* `type` is not suitable.
|
||||
*/
|
||||
|
||||
/* FIXME: We in fact insist on the exact type we want! */
|
||||
if (open_tlvs->channel_type
|
||||
&& !featurebits_eq(state->channel_type->features,
|
||||
open_tlvs->channel_type)) {
|
||||
negotiation_failed(state, false,
|
||||
"Did not support channel_type %s",
|
||||
fmt_featurebits(tmpctx,
|
||||
open_tlvs->channel_type));
|
||||
return NULL;
|
||||
}
|
||||
if (open_tlvs->channel_type) {
|
||||
state->channel_type =
|
||||
channel_type_accept(state,
|
||||
open_tlvs->channel_type,
|
||||
state->our_features,
|
||||
state->their_features);
|
||||
if (!state->channel_type) {
|
||||
negotiation_failed(state, false,
|
||||
"Did not support channel_type %s",
|
||||
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:
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue