diff --git a/channeld/channeld.c b/channeld/channeld.c index 6b6494c1d..305de7e9e 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -2558,7 +2558,8 @@ static void peer_reconnect(struct peer *peer, * channel. */ if (peer->channel->opener == LOCAL) - send_tlvs->desired_type = channel_type(send_tlvs, peer->channel); + send_tlvs->desired_type = channel_desired_type(send_tlvs, + peer->channel); else { /* BOLT-upgrade_protocol #2: * - otherwise: diff --git a/common/initial_channel.c b/common/initial_channel.c index e62f49d93..8270f4a1b 100644 --- a/common/initial_channel.c +++ b/common/initial_channel.c @@ -197,6 +197,13 @@ struct channel_type **channel_upgradable_types(const tal_t *ctx, return arr; } + +struct channel_type *channel_desired_type(const tal_t *ctx, + const struct channel *channel) +{ + /* For now, we just want option_static_remotekey */ + return type_static_remotekey(ctx); +} #endif /* EXPERIMENTAL_FEATURES */ static char *fmt_channel_view(const tal_t *ctx, const struct channel_view *view) diff --git a/common/initial_channel.h b/common/initial_channel.h index f756cd0b0..09f2e86a1 100644 --- a/common/initial_channel.h +++ b/common/initial_channel.h @@ -151,6 +151,10 @@ struct channel_type *channel_type(const tal_t *ctx, /* What features can we upgrade? (Returns NULL if none). */ struct channel_type **channel_upgradable_types(const tal_t *ctx, const struct channel *channel); + +/* What features do we want? */ +struct channel_type *channel_desired_type(const tal_t *ctx, + const struct channel *channel); #endif /* EXPERIMENTAL_FEATURES */ #endif /* LIGHTNING_COMMON_INITIAL_CHANNEL_H */ diff --git a/tests/test_connection.py b/tests/test_connection.py index 89920f59d..fb9677baa 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -3491,7 +3491,21 @@ def test_upgrade_statickey(node_factory, executor): l1.daemon.wait_for_logs([r"They sent current_type \[\]", r"They offered upgrade to \[13\]"]) - l2.daemon.wait_for_log(r"They sent desired_type \[\]") + l2.daemon.wait_for_log(r"They sent desired_type \[13\]") + + l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1') + l2.daemon.wait_for_log('option_static_remotekey enabled at 1/1') + + # Make sure it's committed to db! + wait_for(lambda: l1.db_query('SELECT local_static_remotekey_start, remote_static_remotekey_start FROM channels;') == [{'local_static_remotekey_start': 1, 'remote_static_remotekey_start': 1}]) + + # They will consider themselves upgraded. + l1.rpc.disconnect(l2.info['id'], force=True) + # They won't offer upgrade! + assert not l1.daemon.is_in_log("They offered upgrade", + start=l1.daemon.logsearch_start) + l1.daemon.wait_for_log(r"They sent current_type \[13\]") + l2.daemon.wait_for_log(r"They sent desired_type \[13\]") @unittest.skipIf(not EXPERIMENTAL_FEATURES, "quiescence is experimental")