Skip to content

Commit 5adcbac

Browse files
y0shernoamnelke
authored andcommitted
set the right creation context, use filepath to concatenate paths to prevent errors.
1 parent a0df2b8 commit 5adcbac

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cmd/node/node.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ func (app *SpacemeshApp) initServices(nodeID types.NodeID,
583583
TxsPerBlock: app.Config.TxsPerBlock,
584584
}
585585

586+
database.SwitchCreationContext(dbStorepath, "") // currently only blockbuilder uses this mechanism
586587
blockProducer := miner.NewBlockBuilder(cfg, sgn, swarm, clock.Subscribe(), coinToss, msh, ha, blockOracle, syncer, stateAndMeshProjector, app.txPool, atxdb, app.addLogger(BlockBuilderLogger, lg))
587588
blockListener := sync.NewBlockListener(swarm, syncer, 4, app.addLogger(BlockListenerLogger, lg))
588589

database/interface.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package database
1919
import (
2020
"github.com/spacemeshos/go-spacemesh/log"
2121
"github.com/syndtr/goleveldb/leveldb/iterator"
22+
"path/filepath"
2223
"time"
2324
)
2425

@@ -75,7 +76,7 @@ type ContextDBCreator struct {
7576

7677
// CreateRealDB is a wrapper function that creates a leveldb database
7778
func (c ContextDBCreator) CreateRealDB(file string, cache int, handles int, logger log.Log) (Database, error) {
78-
return NewLDBDatabase(c.Path+c.Context+file, cache, handles, logger)
79+
return NewLDBDatabase(filepath.Join(c.Path+c.Context, file), cache, handles, logger)
7980
}
8081

8182
// CreateMemDB is a wrapper function that creates a memory database to be used only in tests

0 commit comments

Comments
 (0)