From f32609be512d11cfd4147cc376cfab6544ef1a1a Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Fri, 8 Jan 2021 10:22:09 +0000 Subject: [PATCH] chore: fix some linting issues (#349) --- chain/walker_test.go | 6 ++++-- chain/watcher_test.go | 21 ++++----------------- tasks/actorstate/actorstate.go | 3 --- tasks/chain/economics.go | 8 -------- 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/chain/walker_test.go b/chain/walker_test.go index 07e475f57..7f8c83558 100644 --- a/chain/walker_test.go +++ b/chain/walker_test.go @@ -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" @@ -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())) diff --git a/chain/watcher_test.go b/chain/watcher_test.go index 78d043dae..78a7ab1c4 100644 --- a/chain/watcher_test.go +++ b/chain/watcher_test.go @@ -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" @@ -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) @@ -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() diff --git a/tasks/actorstate/actorstate.go b/tasks/actorstate/actorstate.go index bc9ed02a3..1ea39968a 100644 --- a/tasks/actorstate/actorstate.go +++ b/tasks/actorstate/actorstate.go @@ -3,7 +3,6 @@ package actorstate import ( "context" "sync" - "time" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-bitfield" @@ -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 diff --git a/tasks/chain/economics.go b/tasks/chain/economics.go index 81310c195..6f19252d0 100644 --- a/tasks/chain/economics.go +++ b/tasks/chain/economics.go @@ -6,7 +6,6 @@ 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" @@ -14,13 +13,6 @@ import ( "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