mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
channeld: set desired_type to upgrade option_static_remotekey
if not already.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
29f042daac
commit
5526c6797b
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user