Skip to content

Commit

Permalink
chore: fix some linting issues (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
iand authored Jan 8, 2021
1 parent 56d31f3 commit f32609b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 30 deletions.
6 changes: 4 additions & 2 deletions chain/walker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package chain

import (
"context"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/raulk/clock"
"testing"
"time"

"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/raulk/clock"

apitest "github.com/filecoin-project/lotus/api/test"
nodetest "github.com/filecoin-project/lotus/node/test"
"github.com/go-pg/pg/v10"
Expand Down Expand Up @@ -61,6 +62,7 @@ func TestWalker(t *testing.T) {
}

tsIndexer, err := NewTipSetIndexer(opener, strg, builtin.EpochDurationSeconds*time.Second, t.Name(), []string{BlocksTask})
require.NoError(t, err, "NewTipSetIndexer")
t.Logf("initializing indexer")
idx := NewWalker(tsIndexer, opener, 0, int64(head.Height()))

Expand Down
21 changes: 4 additions & 17 deletions chain/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package chain

import (
"context"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/raulk/clock"
"os"
"testing"
"time"

"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/raulk/clock"

"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
apitest "github.com/filecoin-project/lotus/api/test"
Expand Down Expand Up @@ -71,6 +72,7 @@ func TestWatcher(t *testing.T) {
}

tsIndexer, err := NewTipSetIndexer(opener, strg, builtin.EpochDurationSeconds*time.Second, t.Name(), []string{BlocksTask})
require.NoError(t, err, "NewTipSetIndexer")
t.Logf("initializing indexer")
idx := NewWatcher(tsIndexer, opener, 0)

Expand Down Expand Up @@ -159,21 +161,6 @@ func (b blockHeaderList) Rounds() []uint64 {
return rounds
}

func collectTipSetKeys(n lens.API, ts *types.TipSet) ([]string, error) {
keys := []string{ts.Key().String()}

for ts.Height() > 0 {
parent, err := n.ChainGetTipSet(context.TODO(), ts.Parents())
if err != nil {
return nil, err
}
keys = append(keys, parent.Key().String())
ts = parent
}

return keys, nil
}

// collectBlockHeaders walks the chain to collect blocks that should be indexed
func collectBlockHeaders(n lens.API, ts *types.TipSet) (blockHeaderList, error) {
blocks := ts.Blocks()
Expand Down
3 changes: 0 additions & 3 deletions tasks/actorstate/actorstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package actorstate
import (
"context"
"sync"
"time"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
Expand All @@ -21,8 +20,6 @@ import (

var log = logging.Logger("actorstate")

const batchInterval = 100 * time.Millisecond // time to wait between batches

type ActorInfo struct {
Actor types.Actor
Address address.Address
Expand Down
8 changes: 0 additions & 8 deletions tasks/chain/economics.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@ import (

"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors"

"github.com/filecoin-project/sentinel-visor/model"
chainmodel "github.com/filecoin-project/sentinel-visor/model/chain"
"github.com/filecoin-project/sentinel-visor/model/visor"
)

const (
idleSleepInterval = 60 * time.Second // time to wait if the processor runs out of blocks to process
batchInterval = 100 * time.Millisecond // time to wait between batches
)

var log = logging.Logger("chain")

type EconomicsStorage interface {
PersistBatch(ctx context.Context, ps ...model.Persistable) error
MarkTipSetEconomicsComplete(ctx context.Context, tipset string, height int64, completedAt time.Time, errorsDetected string) error
Expand Down

0 comments on commit f32609b

Please sign in to comment.