Skip to content

Commit

Permalink
core: do not run bloom filter if in a temoporary node mode
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Jul 8, 2016
1 parent c33aed6 commit bf3c68e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ func daemonFunc(req cmds.Request, res cmds.Response) {

// Start assembling node config
ncfg := &core.BuildCfg{
Repo: repo,
Repo: repo,
Permament: true,
}
offline, _, _ := req.Option(offlineKwd).Bool()
ncfg.Online = !offline
Expand Down
11 changes: 10 additions & 1 deletion core/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ type BuildCfg struct {
// If online is set, the node will have networking enabled
Online bool

// If permament then node should run more expensive processes
// that will improve performance in long run
Permament bool

// If NilRepo is set, a repo backed by a nil datastore will be constructed
NilRepo bool

Expand Down Expand Up @@ -131,7 +135,12 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {

var err error
bs := bstore.NewBlockstore(n.Repo.Datastore())
n.Blockstore, err = bstore.CachedBlockstore(bs, ctx, bstore.DefaultCacheOpts())
opts := bstore.DefaultCacheOpts()
if !cfg.Permament {
opts.HasBloomFilterSize = 0
}

n.Blockstore, err = bstore.CachedBlockstore(bs, ctx, opts)
if err != nil {
return err
}
Expand Down

0 comments on commit bf3c68e

Please sign in to comment.