Skip to content

Commit

Permalink
merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
darioush committed Aug 17, 2022
1 parent dae8043 commit ce77eb0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 10 additions & 2 deletions local/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func NewNetworkFromSnapshot(
binaryPath string,
buildDir string,
chainConfigs map[string]string,
upgradeConfigs map[string]string,
flags map[string]interface{},
) (network.Network, error) {
net, err := newNetwork(
Expand All @@ -45,7 +46,7 @@ func NewNetworkFromSnapshot(
if err != nil {
return net, err
}
err = net.loadSnapshot(context.Background(), snapshotName, binaryPath, buildDir, chainConfigs, flags)
err = net.loadSnapshot(context.Background(), snapshotName, binaryPath, buildDir, chainConfigs, upgradeConfigs, flags)
return net, err
}

Expand Down Expand Up @@ -157,6 +158,7 @@ func (ln *localNetwork) loadSnapshot(
binaryPath string,
buildDir string,
chainConfigs map[string]string,
upgradeConfigs map[string]string,
flags map[string]interface{},
) error {
ln.lock.Lock()
Expand Down Expand Up @@ -208,14 +210,20 @@ func (ln *localNetwork) loadSnapshot(
networkConfig.NodeConfigs[i].Flags[config.BuildDirKey] = buildDir
}
}
// add chain configs
// add chain configs and upgrade configs
for i := range networkConfig.NodeConfigs {
if networkConfig.NodeConfigs[i].ChainConfigFiles == nil {
networkConfig.NodeConfigs[i].ChainConfigFiles = map[string]string{}
}
if networkConfig.NodeConfigs[i].UpgradeConfigFiles == nil {
networkConfig.NodeConfigs[i].UpgradeConfigFiles = map[string]string{}
}
for k, v := range chainConfigs {
networkConfig.NodeConfigs[i].ChainConfigFiles[k] = v
}
for k, v := range upgradeConfigs {
networkConfig.NodeConfigs[i].UpgradeConfigFiles[k] = v
}
}
return ln.loadConfig(ctx, networkConfig)
}
Expand Down
2 changes: 2 additions & 0 deletions network/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ type Config struct {
BinaryPath string `json:"binaryPath"`
// Chain config files to use per default, if not specified in node config
ChainConfigFiles map[string]string `json:"chainConfigFiles"`
// Upgrade config files to use per default, if not specified in node config
UpgradeConfigFiles map[string]string `json:"upgradeConfigFiles"`
}

// Validate returns an error if this config is invalid
Expand Down
4 changes: 2 additions & 2 deletions network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ type Network interface {
// Get name of available snapshots
GetSnapshotNames() ([]string, error)
// Restart a given node using the same config, optionally changing binary path,
// whitelisted subnets, and a map of chain configs
RestartNode(context.Context, string, string, string, map[string]string) error
// whitelisted subnets, a map of chain configs, and a map of upgrade configs
RestartNode(context.Context, string, string, string, map[string]string, map[string]string) error
// Create the specified blockchains
CreateBlockchains(context.Context, []BlockchainSpec) error
// Create the given numbers of subnets
Expand Down

0 comments on commit ce77eb0

Please sign in to comment.