From 36bed08f90b3487c092016f885f926fe21db3f88 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 2 Oct 2023 09:29:50 +1030 Subject: [PATCH] lightningd: remove peer_any_unsaved_channel and use peer_any_channel. Signed-off-by: Rusty Russell --- lightningd/channel.c | 20 -------------------- lightningd/channel.h | 3 --- lightningd/closing_control.c | 2 +- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/lightningd/channel.c b/lightningd/channel.c index 4c4054142..e072a7b4a 100644 --- a/lightningd/channel.c +++ b/lightningd/channel.c @@ -611,26 +611,6 @@ struct channel *peer_any_channel(struct peer *peer, return ret; } -struct channel *peer_any_unsaved_channel(struct peer *peer, bool *others) -{ - struct channel *channel, *ret = NULL; - - list_for_each(&peer->channels, channel, list) { - if (!channel_unsaved(channel)) - continue; - /* Already found one? */ - if (ret) { - if (others) - *others = true; - } else { - if (others) - *others = false; - ret = channel; - } - } - return ret; -} - struct channel_inflight *channel_inflight_find(struct channel *channel, const struct bitcoin_txid *txid) { diff --git a/lightningd/channel.h b/lightningd/channel.h index 10a7212f0..7d2bd6edd 100644 --- a/lightningd/channel.h +++ b/lightningd/channel.h @@ -642,9 +642,6 @@ struct channel *peer_any_channel(struct peer *peer, bool (*channel_state_filter)(const struct channel *), bool *others); -/* Find a channel which is not yet saved to disk */ -struct channel *peer_any_unsaved_channel(struct peer *peer, bool *others); - struct channel *channel_by_dbid(struct lightningd *ld, const u64 dbid); /* Includes both real scids and aliases. If !privacy_leak_ok, then private diff --git a/lightningd/closing_control.c b/lightningd/closing_control.c index 37b5b3e45..2ae178bb6 100644 --- a/lightningd/closing_control.c +++ b/lightningd/closing_control.c @@ -620,7 +620,7 @@ static struct command_result *param_channel_or_peer(struct command *cmd, if ((*sc)->uc) return NULL; - (*sc)->unsaved_channel = peer_any_unsaved_channel(peer, &more_than_one); + (*sc)->unsaved_channel = peer_any_channel(peer, channel_unsaved, &more_than_one); if ((*sc)->unsaved_channel) { if (more_than_one) goto more_than_one;