Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi: Address some linter complaints. #3155

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/blockchain/agendas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func TestFixedSequenceLocks(t *testing.T) {
// ---------------------------------------------------------------------
// Create block that involves reorganize to a sequence lock spending
// from an output created in a block prior to the parent also spent on
// on the side chain.
// the side chain.
//
// ... -> b0 -> b1 -> b2
// \-> b1a
Expand Down
4 changes: 2 additions & 2 deletions internal/blockchain/indexers/common.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2016 The btcsuite developers
// Copyright (c) 2016-2022 The Decred developers
// Copyright (c) 2016-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -603,7 +603,7 @@ func maybeNotifySubscribers(ctx context.Context, indexer Indexer) error {
bestHeight, bestHash := indexer.Queryer().Best()
tipHeight, tipHash, err := indexer.Tip()
if err != nil {
return fmt.Errorf("%s: unable to fetch index tip: %v",
return fmt.Errorf("%s: unable to fetch index tip: %w",
indexer.Name(), err)
}

Expand Down
4 changes: 2 additions & 2 deletions internal/blockchain/indexers/dropcfindex.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2017 The btcsuite developers
// Copyright (c) 2018-2020 The Decred developers
// Copyright (c) 2018-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand All @@ -23,7 +23,7 @@ var (
)

// DropCfIndex drops the CF index from the provided database if it exists.
func DropCfIndex(ctx context.Context, db database.DB) error {
func DropCfIndex(_ context.Context, db database.DB) error {
// Nothing to do if the index doesn't already exist.
exists, err := existsIndex(db, cfIndexParentBucketKey)
if err != nil {
Expand Down
8 changes: 2 additions & 6 deletions internal/blockchain/indexers/existsaddrindex.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016-2022 The Decred developers
// Copyright (c) 2016-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -193,11 +193,7 @@ func (idx *ExistsAddrIndex) Init(ctx context.Context, chainParams *chaincfg.Para

// Recover the exists address index and its dependents to the main
// chain if needed.
if err := recoverIndex(ctx, idx); err != nil {
return err
}

return nil
return recoverIndex(ctx, idx)
}

// Key returns the database key to use for the index as a byte slice.
Expand Down
3 changes: 1 addition & 2 deletions internal/blockchain/indexers/indexsubscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func newIndexSubscription(subber *IndexSubscriber, indexer Indexer, prereq strin
//
// This must be called with the index subscriber mutex held for writes.
func (s *IndexSubscription) stop() error {

// If the subscription has a prerequisite, find it and remove the
// subscription as a dependency.
if s.prerequisite != noPrereqs {
Expand Down Expand Up @@ -247,7 +246,7 @@ func (s *IndexSubscriber) findLowestIndexTipHeight(queryer ChainQueryer) (int64,
// from after the lowest index tip to the current main chain tip.
//
// This should be called after all indexes have subscribed for updates.
func (s *IndexSubscriber) CatchUp(ctx context.Context, db database.DB, queryer ChainQueryer) error {
func (s *IndexSubscriber) CatchUp(ctx context.Context, _ database.DB, queryer ChainQueryer) error {
lowestHeight, bestHeight, err := s.findLowestIndexTipHeight(queryer)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions internal/blockchain/indexers/txindex.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2016 The btcsuite developers
// Copyright (c) 2016-2022 The Decred developers
// Copyright (c) 2016-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -371,7 +371,7 @@ func (idx *TxIndex) Init(ctx context.Context, chainParams *chaincfg.Params) erro
// below.
var highestKnown, nextUnknown uint32
testBlockID := uint32(1)
increment := uint32(100000)
const increment = uint32(100000)
for {
_, err := dbFetchBlockHashByID(dbTx, testBlockID)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/blockchain/indexers/txindex_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021-2022 The Decred developers
// Copyright (c) 2021-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -113,7 +113,7 @@ func (tc *testChain) Best() (int64, *chainhash.Hash) {
}

// IsTreasuryAgendaActive returns whether or not the treasury agenda is active.
func (tc *testChain) IsTreasuryAgendaActive(hash *chainhash.Hash) (bool, error) {
func (tc *testChain) IsTreasuryAgendaActive(_ *chainhash.Hash) (bool, error) {
return tc.treasuryActive, nil
}

Expand Down