Skip to content

Commit

Permalink
fix(core): look for MFS root in local repo only
Browse files Browse the repository at this point in the history
  • Loading branch information
schomatis authored and lidel committed Jun 21, 2024
1 parent 11bfb3c commit 131a4e1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/node/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func Dag(bs blockservice.BlockService) format.DAGService {
}

// Files loads persisted MFS root
func Files(mctx helpers.MetricsCtx, lc fx.Lifecycle, repo repo.Repo, dag format.DAGService) (*mfs.Root, error) {
func Files(mctx helpers.MetricsCtx, lc fx.Lifecycle, repo repo.Repo, dag format.DAGService, bs blockstore.Blockstore) (*mfs.Root, error) {
dsk := datastore.NewKey("/local/filesroot")
pf := func(ctx context.Context, c cid.Cid) error {
rootDS := repo.Datastore()
Expand Down Expand Up @@ -180,8 +180,12 @@ func Files(mctx helpers.MetricsCtx, lc fx.Lifecycle, repo repo.Repo, dag format.
return nil, err
}

rnd, err := dag.Get(ctx, c)
offineDag := merkledag.NewDAGService(blockservice.New(bs, offline.Exchange(bs)))
rnd, err := offineDag.Get(ctx, c)
if err != nil {
if err == format.ErrNotFound {

Check failure on line 186 in core/node/core.go

View workflow job for this annotation

GitHub Actions / go-check

format.ErrNotFound (type) is not an expression

Check failure on line 186 in core/node/core.go

View workflow job for this annotation

GitHub Actions / go-check

format.ErrNotFound (type) is not an expression

Check failure on line 186 in core/node/core.go

View workflow job for this annotation

GitHub Actions / interop-prep

format.ErrNotFound (type) is not an expression

Check failure on line 186 in core/node/core.go

View workflow job for this annotation

GitHub Actions / go-build

format.ErrNotFound (type) is not an expression

Check failure on line 186 in core/node/core.go

View workflow job for this annotation

GitHub Actions / go-lint

format.ErrNotFound (type) is not an expression (typecheck)

Check failure on line 186 in core/node/core.go

View workflow job for this annotation

GitHub Actions / go-lint

format.ErrNotFound (type) is not an expression) (typecheck)

Check failure on line 186 in core/node/core.go

View workflow job for this annotation

GitHub Actions / go-lint

format.ErrNotFound (type) is not an expression) (typecheck)

Check failure on line 186 in core/node/core.go

View workflow job for this annotation

GitHub Actions / go-lint

format.ErrNotFound (type) is not an expression) (typecheck)

Check failure on line 186 in core/node/core.go

View workflow job for this annotation

GitHub Actions / go-test

format.ErrNotFound (type) is not an expression
return nil, fmt.Errorf("filesystem root not found in local repo: %s", c)
}
return nil, fmt.Errorf("error loading filesroot from DAG: %s", err)
}

Expand Down

0 comments on commit 131a4e1

Please sign in to comment.