diff --git a/core/builder.go b/core/builder.go index bcecc198596..e99169c84d5 100644 --- a/core/builder.go +++ b/core/builder.go @@ -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} } diff --git a/test/sharness/t0046-id-hash.sh b/test/sharness/t0046-id-hash.sh index 19813969ea3..b265200ca11 100755 --- a/test/sharness/t0046-id-hash.sh +++ b/test/sharness/t0046-id-hash.sh @@ -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