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

fix: chain history indexer includes genesis #72

Merged
merged 1 commit into from
Oct 7, 2020
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
17 changes: 8 additions & 9 deletions tasks/indexer/chainhistoryindexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,16 @@ func (c *ChainHistoryIndexer) WalkChain(ctx context.Context, maxHeight int64) er
}

ts := toVisit.Remove(toVisit.Back()).(*types.TipSet)
if ts.Height() == 0 {
continue
}

// TODO: Look for websocket connection closed error and retry after a delay to avoid hot loop
pts, err := c.node.ChainGetTipSet(ctx, ts.Parents())
if err != nil {
return xerrors.Errorf("get tipset: %w", err)
}
if ts.Height() != 0 {
// TODO: Look for websocket connection closed error and retry after a delay to avoid hot loop
pts, err := c.node.ChainGetTipSet(ctx, ts.Parents())
if err != nil {
return xerrors.Errorf("get tipset: %w", err)
}

toVisit.PushBack(pts)
toVisit.PushBack(pts)
}

if blockData.Seen(ts.Key()) {
continue
Expand Down
3 changes: 3 additions & 0 deletions tasks/indexer/chainhistoryindexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

apitest "github.com/filecoin-project/lotus/api/test"
nodetest "github.com/filecoin-project/lotus/node/test"
logging "github.com/ipfs/go-log/v2"

"github.com/go-pg/pg/v10"
"github.com/stretchr/testify/assert"
Expand All @@ -20,6 +21,8 @@ import (
)

func TestChainHistoryIndexer(t *testing.T) {
logging.SetLogLevel("*", "debug")

if testing.Short() || !testutil.DatabaseAvailable() {
t.Skip("short testing requested or VISOR_TEST_DB not set")
}
Expand Down