Skip to content

Commit 6712737

Browse files
committed
openingd: remove compat hacks to "intuit" opt_scid_alias.
This was needed for v23.05 which would set opt_scid_alias even if we didn't. Now everyone handles it properly, we can simply set it unconditionally. Signed-off-by: Rusty Russell <[email protected]> Changelog-Removed: Protocol: backwards compatibility allowances for CLN before 23.08 which didn't handle option_scid_alias properly.
1 parent 3a4e109 commit 6712737

File tree

1 file changed

+6
-60
lines changed

1 file changed

+6
-60
lines changed

openingd/openingd.c

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -268,28 +268,6 @@ static void set_remote_upfront_shutdown(struct state *state,
268268
peer_failed_err(state->pps, &state->channel_id, "%s", err);
269269
}
270270

271-
/* Since we can't send OPT_SCID_ALIAS due to compat issues, intuit whether
272-
* we really actually want it anyway, we just can't say that. */
273-
static bool intuit_scid_alias_type(struct state *state, u8 channel_flags)
274-
{
275-
/* Don't need to intuit if actually set */
276-
if (channel_type_has(state->channel_type, OPT_SCID_ALIAS))
277-
return false;
278-
279-
/* Modern peer: no intuit hacks necessary. */
280-
if (channel_type_has(state->channel_type, OPT_ANCHORS_ZERO_FEE_HTLC_TX))
281-
return false;
282-
283-
/* Public channel: don't want OPT_SCID_ALIAS which means "only use
284-
* alias". */
285-
if (channel_flags & CHANNEL_FLAGS_ANNOUNCE_CHANNEL)
286-
return false;
287-
288-
/* If we both support it, presumably we want it? */
289-
return feature_negotiated(state->our_features, state->their_features,
290-
OPT_SCID_ALIAS);
291-
}
292-
293271
/* We start the 'open a channel' negotation with the supplied peer, but
294272
* stop when we get to the part where we need the funding txid */
295273
static u8 *funder_channel_start(struct state *state, u8 channel_flags,
@@ -431,34 +409,12 @@ static u8 *funder_channel_start(struct state *state, u8 channel_flags,
431409
}
432410

433411
/* Simple case: caller specified, don't allow any variants */
434-
if (ctype) {
435-
if (!featurebits_eq(accept_tlvs->channel_type, state->channel_type->features)) {
436-
negotiation_failed(state,
437-
"Return unoffered channel_type: %s",
438-
fmt_featurebits(tmpctx,
439-
accept_tlvs->channel_type));
440-
return NULL;
441-
}
442-
} else {
443-
/* Except that v23.05 could set OPT_SCID_ALIAS in reply! */
444-
struct channel_type *atype;
445-
446-
atype = channel_type_from(tmpctx, accept_tlvs->channel_type);
447-
if (!channel_type_has(atype, OPT_ANCHORS_ZERO_FEE_HTLC_TX))
448-
featurebits_unset(&atype->features, OPT_SCID_ALIAS);
449-
450-
if (!channel_type_eq(atype, state->channel_type)) {
451-
negotiation_failed(state,
452-
"Return unoffered channel_type: %s",
453-
fmt_featurebits(tmpctx,
454-
accept_tlvs->channel_type));
455-
return NULL;
456-
}
457-
458-
/* If they "accepted" SCID_ALIAS, roll with it. */
459-
tal_free(state->channel_type);
460-
state->channel_type = channel_type_from(state,
461-
accept_tlvs->channel_type);
412+
if (!featurebits_eq(accept_tlvs->channel_type, state->channel_type->features)) {
413+
negotiation_failed(state,
414+
"Return unoffered channel_type: %s",
415+
fmt_featurebits(tmpctx,
416+
accept_tlvs->channel_type));
417+
return NULL;
462418
}
463419

464420
/* BOLT #2:
@@ -564,11 +520,6 @@ static u8 *funder_channel_start(struct state *state, u8 channel_flags,
564520
"Funding channel start: awaiting funding_txid with output to %s",
565521
tal_hex(tmpctx, funding_output_script));
566522

567-
/* Backwards/cross compat hack */
568-
if (!ctype && intuit_scid_alias_type(state, channel_flags)) {
569-
channel_type_set_scid_alias(state->channel_type);
570-
}
571-
572523
return towire_openingd_funder_start_reply(state,
573524
funding_output_script,
574525
feature_negotiated(
@@ -1163,11 +1114,6 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
11631114
&state->channel_id),
11641115
fmt_channel_id(msg, &id_in));
11651116

1166-
/* Backwards/cross compat hack */
1167-
if (intuit_scid_alias_type(state, channel_flags)) {
1168-
channel_type_set_scid_alias(state->channel_type);
1169-
}
1170-
11711117
/*~ Channel is ready; Report the channel parameters to the signer. */
11721118
msg = towire_hsmd_setup_channel(NULL,
11731119
false, /* is_outbound */

0 commit comments

Comments
 (0)