Skip to content

Commit

Permalink
build: fix linter issues, ignore less useful linters
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef committed Feb 11, 2023
1 parent fe5f241 commit d501210
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ linters:
- nilnil
- stylecheck
- thelper
- exhaustruct
- nosnakecase

issues:
exclude-rules:
Expand Down
2 changes: 1 addition & 1 deletion bamboozle_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ var (
// One peer is serving the "old-old" filter which
// contains all OP_RETURN output, we expect this peer
// to be banned first.
name: "old old peer",
name: "very old peer",
peerFilters: map[string]*gcs.Filter{
"a": correctFilter,
"b": oldFilter,
Expand Down
4 changes: 2 additions & 2 deletions blockmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ func newBlockManager(cfg *blockManagerCfg) (*blockManager, error) {
return nil, err
}

// We must also ensure the the filter header tip hash is set to the
// block hash at the filter tip height.
// We must also ensure the filter header tip hash is set to the block
// hash at the filter tip height.
fh, err := cfg.BlockHeaders.FetchHeaderByHeight(bm.filterHeaderTip)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions headerfs/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestAddHeadersIndexRetrieve(t *testing.T) {
t.Fatalf("unable to create test db: %v", err)
}

// First, we'll create a a series of random headers that we'll use to
// First, we'll create a series of random headers that we'll use to
// write into the database.
const numHeaders = 100
headerEntries, headerIndex, err := writeRandomBatch(hIndex, numHeaders)
Expand Down Expand Up @@ -152,7 +152,7 @@ func TestHeaderStorageFallback(t *testing.T) {
t.Fatalf("error writing random batch with old data: %v", err)
}

// Next, we'll create a a series of random headers that we'll use to
// Next, we'll create a series of random headers that we'll use to
// write into the database through the normal interface. This means they
// will be written to the new sub buckets.
newHeaderEntries, _, err := writeRandomBatch(hIndex, numHeaders)
Expand Down
8 changes: 4 additions & 4 deletions neutrino.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var (
// DefaultFilterCacheSize is the size (in bytes) of filters neutrino
// will keep in memory if no size is specified in the neutrino.Config.
// Since we utilize the cache during batch filter fetching, it is
// beneficial if it is able to to keep a whole batch. The current batch
// beneficial if it is able to keep a whole batch. The current batch
// size is 1000, so we default to 30 MB, which can fit about 1450 to
// 2300 mainnet filters.
DefaultFilterCacheSize uint64 = 3120 * 10 * 1000
Expand Down Expand Up @@ -1002,7 +1002,7 @@ func (s *ChainService) BestBlock() (*headerfs.BlockStamp, error) {
return nil, err
}

// Filter headers might lag behind block headers, so we can can fetch a
// Filter headers might lag behind block headers, so we can fetch a
// previous block header if the filter headers are not caught up.
if filterHeight < bestHeight {
bestHeight = filterHeight
Expand Down Expand Up @@ -1572,8 +1572,8 @@ func (s *ChainService) peerDoneHandler(sp *ServerPeer) {
close(sp.quit)
}

// UpdatePeerHeights updates the heights of all peers who have have announced
// the latest connected main chain block, or a recognized orphan. These height
// UpdatePeerHeights updates the heights of all peers who have announced the
// latest connected main chain block, or a recognized orphan. These height
// updates allow us to dynamically refresh peer heights, ensuring sync peer
// selection has access to the latest block heights for each peer.
func (s *ChainService) UpdatePeerHeights(latestBlkHash *chainhash.Hash,
Expand Down
4 changes: 2 additions & 2 deletions query/workmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ Loop:
heap.Push(work, result.job)
currentQueries[result.job.index] = batchNum

// Otherwise we we got a successful result and update
// the status of the batch this query is a part of.
// Otherwise we got a successful result and update the
// status of the batch this query is a part of.
default:
// Reward the peer for the successful query.
w.cfg.Ranking.Reward(result.peer.Addr())
Expand Down
2 changes: 1 addition & 1 deletion rescan.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ rescanLoop:

// If we have to rewind our state, then we'll
// mark ourselves as not current so we can walk
// forward in the chain again until we we are
// forward in the chain again until we are
// current. This is our way of doing a manual
// rescan.
if rewound {
Expand Down
30 changes: 16 additions & 14 deletions sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ var (
// "rd": OnRedeemingTx
// "bd": OnBlockDisconnected
// "fd": OnFilteredBlockDisconnected.
wantLog = func() (log []byte) {
wantLog = func() []byte {
var log []byte
for i := 1096; i <= 1100; i++ {
// FilteredBlockConnected
log = append(log, []byte("fc")...)
Expand Down Expand Up @@ -452,29 +453,30 @@ func testStartRescan(harness *neutrinoHarness, t *testing.T) {
ourIndex = i
}
}
return func(target btcutil.Amount) (total btcutil.Amount,
inputs []*wire.TxIn, inputValues []btcutil.Amount,
scripts [][]byte, err error) {
return func(target btcutil.Amount) (btcutil.Amount,
[]*wire.TxIn, []btcutil.Amount,
[][]byte, error) {

if ourIndex == 1<<30 {
err = fmt.Errorf("Couldn't find our address " +
"in the passed transaction's outputs.")
return
return 0, nil, nil, nil, err
}
total = target
inputs = []*wire.TxIn{
total := target
inputs := []*wire.TxIn{
{
PreviousOutPoint: wire.OutPoint{
Hash: tx.TxHash(),
Index: uint32(ourIndex),
},
},
}
inputValues = []btcutil.Amount{
btcutil.Amount(tx.TxOut[ourIndex].Value)}
scripts = [][]byte{tx.TxOut[ourIndex].PkScript}
err = nil
return
inputValues := []btcutil.Amount{
btcutil.Amount(tx.TxOut[ourIndex].Value),
}
scripts := [][]byte{tx.TxOut[ourIndex].PkScript}

return total, inputs, inputValues, scripts, nil
}
}

Expand Down Expand Up @@ -814,8 +816,8 @@ func testRescanResults(harness *neutrinoHarness, t *testing.T) {
t.Fatalf("Rescan ended with error: %s", err)
}

// Immediately try to add a new update to to the rescan that was just
// shut down. This should fail as it is no longer running.
// Immediately try to add a new update to the rescan that was just shut
// down. This should fail as it is no longer running.
rescan.WaitForShutdown()
err = rescan.Update(neutrino.AddAddrs(addr2), neutrino.Rewind(1095))
if err == nil {
Expand Down

0 comments on commit d501210

Please sign in to comment.