From 25a24d2df652e8e05ae341785d49df625476c103 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Fri, 12 Jan 2024 14:58:09 +0100 Subject: [PATCH] wallet: fix linter/code smell issues --- wallet/createtx.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wallet/createtx.go b/wallet/createtx.go index 2160e5bb3e..13d735e95f 100644 --- a/wallet/createtx.go +++ b/wallet/createtx.go @@ -6,6 +6,7 @@ package wallet import ( + "errors" "fmt" "math/rand" "sort" @@ -250,7 +251,7 @@ func (w *Wallet) txToOutputs(outputs []*wire.TxOut, return nil }) - if err != nil && err != walletdb.ErrDryRunRollBack { + if err != nil && !errors.Is(err, walletdb.ErrDryRunRollBack) { return nil, err } @@ -279,7 +280,7 @@ func (w *Wallet) findEligibleOutputs(dbtx walletdb.ReadTx, output := &unspent[i] // Only include this output if it meets the required number of - // confirmations. Coinbase transactions must have have reached + // confirmations. Coinbase transactions must have reached // maturity before their outputs may be spent. if !confirmed(minconf, output.Height, bs.Height) { continue @@ -377,6 +378,9 @@ func (w *Wallet) addrMgrWithChangeSource(dbtx walletdb.ReadWriteTx, scriptSize = txsizes.P2WPKHPkScriptSize case waddrmgr.TaprootPubKey: scriptSize = txsizes.P2TRPkScriptSize + default: + return nil, nil, fmt.Errorf("unsupported address type: %v", + addrType) } newChangeScript := func() ([]byte, error) {