diff --git a/btc/explorer_api.go b/btc/explorer_api.go index f6c0e8b..18d0073 100644 --- a/btc/explorer_api.go +++ b/btc/explorer_api.go @@ -230,7 +230,7 @@ func (a *ExplorerAPI) PublishTx(rawTxHex string) (string, error) { return body.String(), nil } -func fetchJSON(url string, target interface{}) error { +func fetchJSON(url string, target any) error { resp, err := http.Get(url) if err != nil { return fmt.Errorf("error fetching data from API '%s', "+ diff --git a/cmd/chantools/rescueclosed.go b/cmd/chantools/rescueclosed.go index f4ae827..f6043c3 100644 --- a/cmd/chantools/rescueclosed.go +++ b/cmd/chantools/rescueclosed.go @@ -309,6 +309,7 @@ outer: importStr := "" for addr, wif := range resultMap { + //nolint:modernize,perfsprint importStr += fmt.Sprintf(`importprivkey "%s" "%s" false%s`, wif, addr, "\n") } diff --git a/cmd/chantools/walletinfo.go b/cmd/chantools/walletinfo.go index 9458df0..158cd3f 100644 --- a/cmd/chantools/walletinfo.go +++ b/cmd/chantools/walletinfo.go @@ -227,6 +227,7 @@ func printScopeInfo(name string, w *wallet.Wallet, return "", fmt.Errorf("error fetching account "+ "properties: %w", err) } + //nolint:modernize,perfsprint scopeInfo += fmt.Sprintf( keyScopeformat, scope.Purpose, scope.Coin, name, props.InternalKeyCount, name, props.ExternalKeyCount, diff --git a/cmd/chantools/zombierecovery_findmatches.go b/cmd/chantools/zombierecovery_findmatches.go index f89d8ae..b88fda3 100644 --- a/cmd/chantools/zombierecovery_findmatches.go +++ b/cmd/chantools/zombierecovery_findmatches.go @@ -368,7 +368,7 @@ func fetchChannels(client *graphql.Client, pubkey string) ([]*gqChannel, offset := 0.0 limit := 50.0 - variables := map[string]interface{}{ + variables := map[string]any{ "pubkey": pubkey, "limit": 50.0, "offset": offset, diff --git a/lnd/hdkeychain.go b/lnd/hdkeychain.go index 510b1f3..4161333 100644 --- a/lnd/hdkeychain.go +++ b/lnd/hdkeychain.go @@ -4,6 +4,7 @@ import ( "crypto/sha256" "errors" "fmt" + "slices" "strconv" "strings" @@ -524,25 +525,15 @@ func CheckAndEstimateAddress(addr string, chainParams *chaincfg.Params, } func matchAddrType(addr btcutil.Address, allowedTypes ...AddrType) bool { - contains := func(allowedTypes []AddrType, addrType AddrType) bool { - for _, allowedType := range allowedTypes { - if allowedType == addrType { - return true - } - } - - return false - } - switch addr.(type) { case *btcutil.AddressWitnessPubKeyHash: - return contains(allowedTypes, AddrTypeP2WKH) + return slices.Contains(allowedTypes, AddrTypeP2WKH) case *btcutil.AddressWitnessScriptHash: - return contains(allowedTypes, AddrTypeP2WSH) + return slices.Contains(allowedTypes, AddrTypeP2WSH) case *btcutil.AddressTaproot: - return contains(allowedTypes, AddrTypeP2TR) + return slices.Contains(allowedTypes, AddrTypeP2TR) default: return false