diff --git a/internal/blockchain/agendas_test.go b/internal/blockchain/agendas_test.go index 8cbe87d745..26ad1d420a 100644 --- a/internal/blockchain/agendas_test.go +++ b/internal/blockchain/agendas_test.go @@ -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 diff --git a/internal/blockchain/indexers/common.go b/internal/blockchain/indexers/common.go index 6f1c72c6ac..0aa290ac1a 100644 --- a/internal/blockchain/indexers/common.go +++ b/internal/blockchain/indexers/common.go @@ -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. @@ -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) } diff --git a/internal/blockchain/indexers/dropcfindex.go b/internal/blockchain/indexers/dropcfindex.go index 22928e3e78..96d10f6147 100644 --- a/internal/blockchain/indexers/dropcfindex.go +++ b/internal/blockchain/indexers/dropcfindex.go @@ -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. @@ -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 { diff --git a/internal/blockchain/indexers/existsaddrindex.go b/internal/blockchain/indexers/existsaddrindex.go index a082621eaf..86bf8b08cd 100644 --- a/internal/blockchain/indexers/existsaddrindex.go +++ b/internal/blockchain/indexers/existsaddrindex.go @@ -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. @@ -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. diff --git a/internal/blockchain/indexers/indexsubscriber.go b/internal/blockchain/indexers/indexsubscriber.go index 7aeb0f99ce..88c0d1971d 100644 --- a/internal/blockchain/indexers/indexsubscriber.go +++ b/internal/blockchain/indexers/indexsubscriber.go @@ -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 { @@ -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 diff --git a/internal/blockchain/indexers/txindex.go b/internal/blockchain/indexers/txindex.go index 074c00bc59..212e89fb99 100644 --- a/internal/blockchain/indexers/txindex.go +++ b/internal/blockchain/indexers/txindex.go @@ -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. @@ -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 { diff --git a/internal/blockchain/indexers/txindex_test.go b/internal/blockchain/indexers/txindex_test.go index b11088b4c7..82e1fc109b 100644 --- a/internal/blockchain/indexers/txindex_test.go +++ b/internal/blockchain/indexers/txindex_test.go @@ -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. @@ -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 }