From 67eb26c5e620047f7f83c701cb35757d41c4cfb3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 13 Jun 2019 07:55:23 +0930 Subject: [PATCH] lightningd: fix bogus channel iteration on setchannelfee Setting channel to NULL then iterating doesn't work! Fixes: #2733 Signed-off-by: Rusty Russell --- lightningd/peer_control.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 6b7b21e43..b56ed9c0b 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1537,15 +1537,13 @@ static struct command_result *json_setchannelfee(struct command *cmd, /* If the users requested 'all' channels we need to iterate */ if (channel == NULL) { list_for_each(&cmd->ld->peers, peer, list) { - list_for_each(&peer->channels, channel, list) { - channel = peer_active_channel(peer); - if (!channel) - continue; - if (channel->state != CHANNELD_NORMAL && - channel->state != CHANNELD_AWAITING_LOCKIN) - continue; - set_channel_fees(cmd, channel, *base, *ppm, response); - } + channel = peer_active_channel(peer); + if (!channel) + continue; + if (channel->state != CHANNELD_NORMAL && + channel->state != CHANNELD_AWAITING_LOCKIN) + continue; + set_channel_fees(cmd, channel, *base, *ppm, response); } /* single channel should be updated */