Skip to content

Commit

Permalink
Node id file to be stored on datadir instead of post-datadir
Browse files Browse the repository at this point in the history
  • Loading branch information
moshababo authored and noamnelke committed Feb 25, 2020
1 parent f4cdd3a commit 06cf776
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ func (app *SpacemeshApp) LoadOrCreateEdSigner() (*signing.EdSigner, error) {
log.Warning("Failed to find identity file: %v", err)

edSgn := signing.NewEdSigner()
f = filepath.Join(shared.GetInitDir(app.Config.POST.DataDir, edSgn.PublicKey().Bytes()), edKeyFileName)
f = filepath.Join(shared.GetInitDir(app.Config.DataDir, edSgn.PublicKey().Bytes()), edKeyFileName)
err := os.MkdirAll(filepath.Dir(f), filesystem.OwnerReadWriteExec)
if err != nil {
return nil, fmt.Errorf("failed to create directory for identity file: %v", err)
Expand Down Expand Up @@ -754,7 +754,7 @@ func (identityFileFound) Error() string {

func (app *SpacemeshApp) getIdentityFile() (string, error) {
var f string
err := filepath.Walk(app.Config.POST.DataDir, func(path string, info os.FileInfo, err error) error {
err := filepath.Walk(app.Config.DataDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestSpacemeshApp_getEdIdentity(t *testing.T) {

// setup spacemesh app
app := NewSpacemeshApp()
app.Config.POST.DataDir = "tmp"
app.Config.DataDir = "tmp"
app.log = log.NewDefault("logger")

// get new identity
Expand Down

0 comments on commit 06cf776

Please sign in to comment.