Skip to content

Commit

Permalink
fix: regen addrbook json (#624)
Browse files Browse the repository at this point in the history
* regenerate addrbook.json

* lint

* change perms
  • Loading branch information
czarcas7ic authored Sep 26, 2024
1 parent c88c7c3 commit e7668ca
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net"
"os"
"path/filepath"
"runtime/pprof"
"strings"
"time"
Expand Down Expand Up @@ -750,6 +751,17 @@ func testnetify(ctx *Context, testnetAppCreator types.AppCreator, db dbm.DB, tra
return nil, err
}

// Regenerate addrbook.json to prevent peers on old network from causing error logs.
addrBookPath := filepath.Join(config.RootDir, "config", "addrbook.json")
if err := os.Remove(addrBookPath); err != nil && !os.IsNotExist(err) {
return nil, fmt.Errorf("failed to remove existing addrbook.json: %w", err)
}

emptyAddrBook := []byte("{}")
if err := os.WriteFile(addrBookPath, emptyAddrBook, 0o600); err != nil {
return nil, fmt.Errorf("failed to create empty addrbook.json: %w", err)
}

// Load the comet genesis doc provider.
genDocProvider := node.DefaultGenesisDocProviderFunc(config)

Expand Down

0 comments on commit e7668ca

Please sign in to comment.