lightningd: remove peer_any_unsaved_channel and use peer_any_channel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-10-02 09:29:50 +10:30
parent 0b4622bcbd
commit 36bed08f90
3 changed files with 1 additions and 24 deletions

View File

@ -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)
{

View File

@ -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

View File

@ -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;