From 6f26f2a5b37093f72e84c747c70b75baa1d8c233 Mon Sep 17 00:00:00 2001 From: ziggie Date: Tue, 10 Sep 2024 15:44:48 +0200 Subject: [PATCH] chanfunding: remove unsupported linter directive. Remove unsupported linter and also change ifelse clause to switch statement. --- lnwallet/chanfunding/coin_select.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lnwallet/chanfunding/coin_select.go b/lnwallet/chanfunding/coin_select.go index 9bf7f2dc0..b9ff1be21 100644 --- a/lnwallet/chanfunding/coin_select.go +++ b/lnwallet/chanfunding/coin_select.go @@ -373,7 +373,8 @@ func CoinSelectUpToAmount(feeRate chainfee.SatPerKWeight, minAmount, maxAmount, ) var errInsufficientFunds *ErrInsufficientFunds - if err == nil { //nolint:gocritic,ifElseChain + switch { + case err == nil: // If the coin selection succeeds we check if our total balance // covers the selected set of coins including fees plus an // optional anchor reserve. @@ -396,11 +397,13 @@ func CoinSelectUpToAmount(feeRate chainfee.SatPerKWeight, minAmount, maxAmount, // our total balance minus reserve and fees. selectSubtractFee = true } - } else if errors.As(err, &errInsufficientFunds) { + + case errors.As(err, &errInsufficientFunds): // If the initial coin selection fails due to insufficient funds // we select our total available balance minus fees. selectSubtractFee = true - } else { + + default: return nil, 0, 0, err }