From b30328a91f6b86f463c56f38566a23278fcfa720 Mon Sep 17 00:00:00 2001 From: niftynei Date: Tue, 8 Feb 2022 14:39:50 -0600 Subject: [PATCH] coin_mvt: rm unncessary if statement We don't need to switch on this; if it's zero the below ops will be effectiely no-ops. --- lightningd/channel_control.c | 37 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index d36baacd8..0d70aa039 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -138,26 +138,23 @@ void channel_record_open(struct channel *channel) blockheight = short_channel_id_blocknum(channel->scid); /* If funds were pushed, add/sub them from the starting balance */ - if (is_pushed) { - if (channel->opener == LOCAL) { - if (!amount_msat_add(&start_balance, - channel->our_msat, channel->push)) - fatal("Unable to add push_msat (%s) + our_msat (%s)", - type_to_string(tmpctx, struct amount_msat, - &channel->push), - type_to_string(tmpctx, struct amount_msat, - &channel->our_msat)); - } else { - if (!amount_msat_sub(&start_balance, - channel->our_msat, channel->push)) - fatal("Unable to sub our_msat (%s) - push (%s)", - type_to_string(tmpctx, struct amount_msat, - &channel->our_msat), - type_to_string(tmpctx, struct amount_msat, - &channel->push)); - } - } else - start_balance = channel->our_msat; + if (channel->opener == LOCAL) { + if (!amount_msat_add(&start_balance, + channel->our_msat, channel->push)) + fatal("Unable to add push_msat (%s) + our_msat (%s)", + type_to_string(tmpctx, struct amount_msat, + &channel->push), + type_to_string(tmpctx, struct amount_msat, + &channel->our_msat)); + } else { + if (!amount_msat_sub(&start_balance, + channel->our_msat, channel->push)) + fatal("Unable to sub our_msat (%s) - push (%s)", + type_to_string(tmpctx, struct amount_msat, + &channel->our_msat), + type_to_string(tmpctx, struct amount_msat, + &channel->push)); + } mvt = new_coin_channel_open(tmpctx, &channel->cid,