Skip to content

Commit

Permalink
add plugin dir param to restart node, add node, and do some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemadero committed Jan 6, 2023
1 parent 7da388f commit 1e1f951
Show file tree
Hide file tree
Showing 6 changed files with 336 additions and 299 deletions.
2 changes: 1 addition & 1 deletion local/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ func (ln *localNetwork) restartNodesWithWhitelistedSubnets(
delete(nodeConfig.Flags, config.WhitelistedSubnetsKey)

ln.log.Info("removing and adding back the node for whitelisted subnets", zap.String("node-name", nodeName))
if err := ln.restartNode(ctx, nodeName, "", "", nil, nil, nil); err != nil {
if err := ln.restartNode(ctx, nodeName, "", "", "", nil, nil, nil); err != nil {
return err
}

Expand Down
18 changes: 15 additions & 3 deletions local/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ func (ln *localNetwork) RestartNode(
ctx context.Context,
nodeName string,
binaryPath string,
pluginDir string,
whitelistedSubnets string,
chainConfigs map[string]string,
upgradeConfigs map[string]string,
Expand All @@ -806,13 +807,23 @@ func (ln *localNetwork) RestartNode(
ln.lock.Lock()
defer ln.lock.Unlock()

return ln.restartNode(ctx, nodeName, binaryPath, whitelistedSubnets, chainConfigs, upgradeConfigs, subnetConfigs)
return ln.restartNode(
ctx,
nodeName,
binaryPath,
pluginDir,
whitelistedSubnets,
chainConfigs,
upgradeConfigs,
subnetConfigs,
)
}

func (ln *localNetwork) restartNode(
ctx context.Context,
nodeName string,
binaryPath string,
pluginDir string,
whitelistedSubnets string,
chainConfigs map[string]string,
upgradeConfigs map[string]string,
Expand All @@ -827,8 +838,9 @@ func (ln *localNetwork) restartNode(

if binaryPath != "" {
nodeConfig.BinaryPath = binaryPath
// remove old value if present, to look for vm binaries in new binary path location
delete(nodeConfig.Flags, PluginDirKey)
}
if pluginDir != "" {
nodeConfig.Flags[PluginDirKey] = pluginDir
}

if whitelistedSubnets != "" {
Expand Down
2 changes: 1 addition & 1 deletion network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type Network interface {
// Restart a given node using the same config, optionally changing binary path,
// whitelisted subnets, a map of chain configs, a map of upgrade configs, and
// a map of subnet configs
RestartNode(context.Context, string, string, string, map[string]string, map[string]string, map[string]string) error
RestartNode(context.Context, string, string, string, string, map[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
Loading

0 comments on commit 1e1f951

Please sign in to comment.