Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
darioush committed Aug 18, 2022
1 parent 4c66cb9 commit d6c61a0
Show file tree
Hide file tree
Showing 6 changed files with 403 additions and 421 deletions.
2 changes: 1 addition & 1 deletion cmd/control/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func newStartCommand() *cobra.Command {
&upgradeConfigs,
"upgrade-configs",
"",
"[optional] JSON string of map from chain id to its config file contents",
"[optional] JSON string of map from chain id to its upgrade file contents",
)
if err := cmd.MarkPersistentFlagRequired("avalanchego-path"); err != nil {
panic(err)
Expand Down
9 changes: 9 additions & 0 deletions local/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ type localNetwork struct {
binaryPath string
// chain config files to use per default
chainConfigFiles map[string]string
// upgrade config files to use per default
upgradeConfigFiles map[string]string
}

var (
Expand Down Expand Up @@ -394,6 +396,7 @@ func (ln *localNetwork) loadConfig(ctx context.Context, networkConfig network.Co
ln.flags = networkConfig.Flags
ln.binaryPath = networkConfig.BinaryPath
ln.chainConfigFiles = networkConfig.ChainConfigFiles
ln.upgradeConfigFiles = networkConfig.UpgradeConfigFiles

// Sort node configs so beacons start first
var nodeConfigs []node.Config
Expand Down Expand Up @@ -452,6 +455,12 @@ func (ln *localNetwork) addNode(nodeConfig node.Config) (node.Node, error) {
nodeConfig.ChainConfigFiles[k] = v
}
}
for k, v := range ln.upgradeConfigFiles {
_, ok := nodeConfig.UpgradeConfigFiles[k]
if !ok {
nodeConfig.UpgradeConfigFiles[k] = v
}
}
addNetworkFlags(ln.log, ln.flags, nodeConfig.Flags)

// it shouldn't happen that just one is empty, most probably both,
Expand Down
11 changes: 6 additions & 5 deletions local/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ func (ln *localNetwork) SaveSnapshot(ctx context.Context, snapshotName string) (
}
// save network conf
networkConfig := network.Config{
Genesis: string(ln.genesis),
Flags: networkConfigFlags,
NodeConfigs: []node.Config{},
BinaryPath: ln.binaryPath,
ChainConfigFiles: ln.chainConfigFiles,
Genesis: string(ln.genesis),
Flags: networkConfigFlags,
NodeConfigs: []node.Config{},
BinaryPath: ln.binaryPath,
ChainConfigFiles: ln.chainConfigFiles,
UpgradeConfigFiles: ln.upgradeConfigFiles,
}

for _, nodeConfig := range nodesConfig {
Expand Down
Loading

0 comments on commit d6c61a0

Please sign in to comment.