Skip to content

Commit

Permalink
multi: fix some linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dajohi committed Sep 19, 2024
1 parent a93f661 commit 4b3ccac
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion internal/rpc/rpcserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ func (s *walletServer) BirthBlock(ctx context.Context, req *pb.BirthBlockRequest
if birthState != nil {
errMsg = "birth block is pending..."
}
return nil, status.Errorf(codes.NotFound, errMsg)
return nil, status.Errorf(codes.NotFound, "%s", errMsg)
}

return &pb.BirthBlockResponse{
Expand Down
2 changes: 1 addition & 1 deletion p2p/peering.go
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ func (rp *RemotePeer) CFiltersV2(ctx context.Context, blockHashes []*chainhash.H
if !stalled.Stop() {
<-stalled.C
}
stalled.Reset(stallTimeout - time.Now().Sub(req.t))
stalled.Reset(stallTimeout - time.Since(req.t))
case m := <-req.c:
var f *gcs.FilterV2
var err error
Expand Down
9 changes: 3 additions & 6 deletions spv/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -894,11 +894,8 @@ func (s *Syncer) checkTSpend(ctx context.Context, tx *wire.MsgTx) bool {
// Verify that the signature is valid and corresponds to the
// provided public key.
err = s.verifyTSpendSignature(tx, signature, pubKey)
if err != nil {
return false
}

return true
return err == nil
}

// GetInitState requests the init state, then using the tspend hashes requests
Expand Down Expand Up @@ -1138,8 +1135,8 @@ func (s *Syncer) handleMixInvs(ctx context.Context, rp *p2p.RemotePeer, hashes [
}

// receiveHeaderAnnouncements receives all block announcements through pushed
// headers messages messages from peers and starts goroutines to handle the
// announced header.
// headers messages from peers and starts goroutines to handle the announced
// header.
func (s *Syncer) receiveHeadersAnnouncements(ctx context.Context) error {
for {
rp, headers, err := s.lp.ReceiveHeadersAnnouncement(ctx)
Expand Down
6 changes: 3 additions & 3 deletions wallet/createtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ func (w *Wallet) findEligibleOutputs(dbtx walletdb.ReadTx, account uint32, minco
}

// 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, currentHeight) {
continue
Expand Down Expand Up @@ -1853,13 +1853,13 @@ func (w *Wallet) findEligibleOutputsAmount(dbtx walletdb.ReadTx, account uint32,
}

// 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, currentHeight) {
return true
}

// When a minumum amount is required, skip when it is less.
// When a minimum amount is required, skip when it is less.
if minAmount != 0 && output.Amount < minAmount {
return true
}
Expand Down
2 changes: 1 addition & 1 deletion wallet/sidechains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestPruneChainFromSRT(t *testing.T) {
}

// Prune chain0. chain1 and chain2 are new rooted trees and chain3 is a
// a tip in chain2.
// tip in chain2.
// b1 -> c1 -> d1 -> e1
// b2 -> c2 -> d2 -> e2
// \-> d3 -> e3
Expand Down
2 changes: 1 addition & 1 deletion wallet/txauthor/author.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func sumOutputValues(outputs []*wire.TxOut) (totalOutput dcrutil.Amount) {
//
// If successful, the transaction, total input value spent, and all previous
// output scripts are returned. If the input source was unable to provide
// enough input value to pay for every output any any necessary fees, an
// enough input value to pay for every output any necessary fees, an
// InputSourceError is returned.
func NewUnsignedTransaction(outputs []*wire.TxOut, relayFeePerKb dcrutil.Amount,
fetchInputs InputSource, fetchChange ChangeSource, maxTxSize int) (*AuthoredTx, error) {
Expand Down
2 changes: 1 addition & 1 deletion wallet/udb/addressmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ func testEncryptDecryptErrors(ctx context.Context, tc *testContext) {
}
}

// testEncryptDecrypt ensures that encrypting and decrypting data with the
// testEncryptDecrypt ensures that encrypting and decrypting data with
// the various crypto key types works as expected.
func testEncryptDecrypt(ctx context.Context, tc *testContext) {
plainText := []byte("this is a plaintext")
Expand Down
2 changes: 1 addition & 1 deletion wallet/udb/internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// license that can be found in the LICENSE file.

/*
This test file is part of the waddrmgr package rather than than the
This test file is part of the waddrmgr package rather than the
waddrmgr_test package so it can bridge access to the internals to properly test
cases which are either not possible or can't reliably be tested via the public
interface. The functions are only exported while the tests are being run.
Expand Down
2 changes: 1 addition & 1 deletion wallet/udb/txdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ func extractRawUnminedTx(v []byte) []byte {

// Unmined transactions which have been saved in an unpublished state are
// recorded as such in the unpublished bucket keyed by the transaction hash.
// The value is is a single non-zero byte if the transaction is unpublished, or
// The value is a single non-zero byte if the transaction is unpublished, or
// zero or missing from the bucket when published.

func putUnpublished(ns walletdb.ReadWriteBucket, k []byte) error {
Expand Down
2 changes: 1 addition & 1 deletion wallet/udb/txmined.go
Original file line number Diff line number Diff line change
Expand Up @@ -3291,7 +3291,7 @@ func (s *Store) MakeInputSource(dbtx walletdb.ReadTx, account uint32, minConf,
}

// 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.
txHeight := extractRawCreditHeight(cKey)
if !confirmed(minConf, txHeight, syncHeight) {
Expand Down
2 changes: 1 addition & 1 deletion wallet/udb/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const (
tspendPolicyVersion = 19

// vspBucketVersion is the 20th version of the database. It adds a
// a top-level bucket for recording vsp ticket hashes as key and its
// top-level bucket for recording vsp ticket hashes as key and its
// related fee txs hash.
vspBucketVersion = 20

Expand Down
2 changes: 1 addition & 1 deletion wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -4737,7 +4737,7 @@ func (w *Wallet) CreateVspPayment(ctx context.Context, tx *wire.MsgTx, fee dcrut
if err != nil {
return err
}
return fmt.Errorf(sigErrStr)
return fmt.Errorf("%s", sigErrStr)
}

err = w.SetPublished(ctx, &feeHash, false)
Expand Down

0 comments on commit 4b3ccac

Please sign in to comment.