Skip to content

Commit

Permalink
Fix filestore so it works correctly with the idstore.
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
  • Loading branch information
kevina committed Jun 15, 2018
1 parent 8af6f31 commit 626458d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {

if conf.Experimental.FilestoreEnabled {
// hash security
n.Filestore = filestore.NewFilestore(bs, n.Repo.FileManager())
n.Filestore = filestore.NewFilestore(wbs, n.Repo.FileManager())
n.Blockstore = bstore.NewGCBlockstore(n.Filestore, n.GCLocker)
n.Blockstore = &verifbs.VerifBSGC{GCBlockstore: n.Blockstore}
}
Expand Down
28 changes: 28 additions & 0 deletions test/sharness/t0046-id-hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,32 @@ test_expect_success "can still fetch it" '
test_cmp junk.txt actual
'

test_expect_success "enable filestore" '
ipfs config --json Experimental.FilestoreEnabled true
'

test_expect_success "can fetch random id hash (filestore enabled)" '
ipfs cat $ID_HASH0 > expected &&
echo $ID_HASH0_CONTENTS > actual &&
test_cmp expected actual
'

test_expect_success "can pin random id hash (filestore enabled)" '
ipfs pin add $ID_HASH0
'

test_expect_success "ipfs add succeeds with id hash and --nocopy" '
echo "djkd7jdkd7jkHHG" > junk.txt &&
HASH=$(ipfs add -q --hash=id --nocopy junk.txt)
'

test_expect_success "content not actually added (filestore enabled)" '
ipfs refs local | fgrep -q -v $HASH
'

test_expect_success "but can fetch it anyway (filestore enabled)" '
ipfs cat $HASH > actual &&
test_cmp junk.txt actual
'

test_done

0 comments on commit 626458d

Please sign in to comment.