Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: regenerate addrbook.json for in-place-testnet (backport #21941) #21947

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (crypto/keyring) [#21653](https://github.com/cosmos/cosmos-sdk/pull/21653) New Linux-only backend that adds Linux kernel's `keyctl` support.

### Improvements

* (server) [#21941](https://github.com/cosmos/cosmos-sdk/pull/21941) Regenerate addrbook.json for in place testnet.

### Bug Fixes

* (sims) [21906](https://github.com/cosmos/cosmos-sdk/pull/21906) Skip sims test when running dry on validators
Expand Down
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 @@ -749,6 +750,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
Loading