lightningd: add dev-any-channel-type to allow obsolete channel types.
We're about to make static_remotekey compulsory, but we still want to do tests for pre-existing channels. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -226,6 +226,8 @@ struct state {
|
||||
|
||||
/* Does this negotation require confirmed inputs? */
|
||||
bool require_confirmed_inputs[NUM_SIDES];
|
||||
|
||||
bool dev_accept_any_channel_type;
|
||||
};
|
||||
|
||||
/* psbt_changeset_get_next - Get next message to send
|
||||
@@ -2424,11 +2426,18 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
|
||||
open_tlv->channel_type,
|
||||
state->our_features);
|
||||
if (!state->channel_type) {
|
||||
negotiation_failed(state,
|
||||
"Did not support channel_type %s",
|
||||
fmt_featurebits(tmpctx,
|
||||
open_tlv->channel_type));
|
||||
return;
|
||||
if (state->dev_accept_any_channel_type) {
|
||||
status_unusual("dev-any-channel-type: accepting %s",
|
||||
fmt_featurebits(tmpctx,
|
||||
open_tlv->channel_type));
|
||||
state->channel_type = channel_type_from(state, open_tlv->channel_type);
|
||||
} else {
|
||||
negotiation_failed(state,
|
||||
"Did not support channel_type %s",
|
||||
fmt_featurebits(tmpctx,
|
||||
open_tlv->channel_type));
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else
|
||||
state->channel_type
|
||||
@@ -4372,7 +4381,8 @@ int main(int argc, char *argv[])
|
||||
&state->our_points,
|
||||
&state->our_funding_pubkey,
|
||||
&state->minimum_depth,
|
||||
&state->require_confirmed_inputs[LOCAL])) {
|
||||
&state->require_confirmed_inputs[LOCAL],
|
||||
&state->dev_accept_any_channel_type)) {
|
||||
/*~ Initially we're not associated with a channel, but
|
||||
* handle_peer_gossip_or_error compares this. */
|
||||
memset(&state->channel_id, 0, sizeof(state->channel_id));
|
||||
|
||||
@@ -29,6 +29,7 @@ msgdata,dualopend_init,our_funding_pubkey,pubkey,
|
||||
# Constraints in case the other end tries to open a channel.
|
||||
msgdata,dualopend_init,minimum_depth,u32,
|
||||
msgdata,dualopend_init,require_confirmed_inputs,bool,
|
||||
msgdata,dualopend_init,dev_accept_any_channel_type,bool,
|
||||
|
||||
# master-dualopend: peer has reconnected
|
||||
msgtype,dualopend_reinit,7001
|
||||
|
||||
|
@@ -103,6 +103,8 @@ struct state {
|
||||
struct amount_sat *reserve;
|
||||
|
||||
bool allowdustreserve;
|
||||
|
||||
bool dev_accept_any_channel_type;
|
||||
};
|
||||
|
||||
/*~ If we can't agree on parameters, we fail to open the channel.
|
||||
@@ -965,11 +967,18 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
|
||||
state->channel_type = channel_type_accept(
|
||||
state, open_tlvs->channel_type, state->our_features);
|
||||
if (!state->channel_type) {
|
||||
negotiation_failed(state,
|
||||
"Did not support channel_type %s",
|
||||
fmt_featurebits(tmpctx,
|
||||
open_tlvs->channel_type));
|
||||
return NULL;
|
||||
if (state->dev_accept_any_channel_type) {
|
||||
status_unusual("dev-any-channel-type: accepting %s",
|
||||
fmt_featurebits(tmpctx,
|
||||
open_tlvs->channel_type));
|
||||
state->channel_type = channel_type_from(state, open_tlvs->channel_type);
|
||||
} else {
|
||||
negotiation_failed(state,
|
||||
"Did not support channel_type %s",
|
||||
fmt_featurebits(tmpctx,
|
||||
open_tlvs->channel_type));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
open_channel_had_channel_type = false;
|
||||
@@ -1548,7 +1557,8 @@ int main(int argc, char *argv[])
|
||||
&state->minimum_depth,
|
||||
&state->min_feerate, &state->max_feerate,
|
||||
&state->dev_force_tmp_channel_id,
|
||||
&state->allowdustreserve))
|
||||
&state->allowdustreserve,
|
||||
&state->dev_accept_any_channel_type))
|
||||
master_badmsg(WIRE_OPENINGD_INIT, msg);
|
||||
|
||||
/* 3 == peer, 4 = hsmd */
|
||||
|
||||
@@ -28,6 +28,7 @@ msgdata,openingd_init,dev_temporary_channel_id,?byte,32
|
||||
# reserves? This is explicitly required by the spec for safety
|
||||
# reasons, but some implementations and users keep asking for it.
|
||||
msgdata,openingd_init,allowdustreserve,bool,
|
||||
msgdata,openingd_init,dev_accept_any_channel_type,bool,
|
||||
|
||||
# Openingd->master: they offered channel, should we continue?
|
||||
msgtype,openingd_got_offer,6005
|
||||
|
||||
|
Reference in New Issue
Block a user