Skip to content

Commit

Permalink
regenerate addrbook.json
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Sep 26, 2024
1 parent c88c7c3 commit ca87287
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, 0644); 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 ca87287

Please sign in to comment.