@@ -562,7 +562,7 @@ func (n *Network) CreateSubnets(ctx context.Context, w io.Writer) error {
562
562
return err
563
563
}
564
564
565
- // Reconfigure nodes for the new subnets and their chains
565
+ // Reconfigure nodes for the new subnets
566
566
if _ , err := fmt .Fprintf (w , "Configured nodes to track new subnet(s). Restart is required.\n " ); err != nil {
567
567
return err
568
568
}
@@ -571,8 +571,8 @@ func (n *Network) CreateSubnets(ctx context.Context, w io.Writer) error {
571
571
return err
572
572
}
573
573
}
574
-
575
574
// Restart nodes to allow new configuration to take effect
575
+ // TODO(marun) Only restart the validator nodes of newly-created subnets
576
576
if err := n .Restart (ctx , w ); err != nil {
577
577
return err
578
578
}
@@ -589,6 +589,7 @@ func (n *Network) CreateSubnets(ctx context.Context, w io.Writer) error {
589
589
590
590
// Wait for nodes to become subnet validators
591
591
pChainClient := platformvm .NewClient (n .Nodes [0 ].URI )
592
+ restartRequired := false
592
593
for _ , subnet := range createdSubnets {
593
594
if err := waitForActiveValidators (ctx , w , pChainClient , subnet ); err != nil {
594
595
return err
@@ -606,9 +607,22 @@ func (n *Network) CreateSubnets(ctx context.Context, w io.Writer) error {
606
607
if _ , err := fmt .Fprintf (w , " wrote chain configuration for subnet %q\n " , subnet .Name ); err != nil {
607
608
return err
608
609
}
610
+
611
+ // If one or more of the subnets chains have explicit configuration, the
612
+ // subnet's validator nodes will need to be restarted for those nodes to read
613
+ // the newly written chain configuration and apply it to the chain(s).
614
+ if subnet .HasChainConfig () {
615
+ restartRequired = true
616
+ }
609
617
}
610
618
611
- return nil
619
+ if ! restartRequired {
620
+ return nil
621
+ }
622
+
623
+ // Restart nodes to allow configuration for the new chains to take effect
624
+ // TODO(marun) Only restart the validator nodes of subnets that have chains that need configuring
625
+ return n .Restart (ctx , w )
612
626
}
613
627
614
628
func (n * Network ) GetURIForNodeID (nodeID ids.NodeID ) (string , error ) {
0 commit comments