mirror of
https://github.com/guggero/chantools.git
synced 2026-08-13 12:33:34 +02:00
multi: fix new linter errors
This commit is contained in:
parent
cfeb370abf
commit
f427d66243
5 changed files with 8 additions and 15 deletions
|
|
@ -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', "+
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue