diff --git a/cmd/control/control.go b/cmd/control/control.go index 1e260ea5..e703bf87 100644 --- a/cmd/control/control.go +++ b/cmd/control/control.go @@ -52,7 +52,7 @@ func NewCommand() *cobra.Command { cmd.PersistentFlags().StringVar(&logDir, "log-dir", "", "log directory") cmd.PersistentFlags().StringVar(&endpoint, "endpoint", "localhost:8080", "server endpoint") cmd.PersistentFlags().DurationVar(&dialTimeout, "dial-timeout", 10*time.Second, "server dial timeout") - cmd.PersistentFlags().DurationVar(&requestTimeout, "request-timeout", 3*time.Minute, "client request timeout") + cmd.PersistentFlags().DurationVar(&requestTimeout, "request-timeout", 5*time.Minute, "client request timeout") cmd.AddCommand( newRPCVersionCommand(), diff --git a/server/network.go b/server/network.go index 628c5f2e..25aa62b7 100644 --- a/server/network.go +++ b/server/network.go @@ -611,72 +611,70 @@ func (lc *localNetwork) updateSubnetInfo(ctx context.Context) error { } } - blockchains, err := node.GetAPIClient().PChainAPI().GetBlockchains(ctx) - if err != nil { - return err - } - - for _, blockchain := range blockchains { - if blockchain.Name == "C-Chain" || blockchain.Name == "X-Chain" { - continue - } - lc.customChainIDToInfo[blockchain.ID] = chainInfo{ - info: &rpcpb.CustomChainInfo{ - ChainName: blockchain.Name, - VmId: blockchain.VMID.String(), - SubnetId: blockchain.SubnetID.String(), - ChainId: blockchain.ID.String(), - }, - subnetID: blockchain.SubnetID, - blockchainID: blockchain.ID, - } - } - - subnets, err := node.GetAPIClient().PChainAPI().GetSubnets(ctx, nil) - if err != nil { - return err - } - - subnetIDList := []string{} - for _, subnet := range subnets { - if subnet.ID != avago_constants.PlatformChainID { - subnetIDList = append(subnetIDList, subnet.ID.String()) - } - } - - for _, subnetIDStr := range subnetIDList { - subnetID, err := ids.FromString(subnetIDStr) + if !utils.IsPublicNetwork(lc.options.networkID) { + blockchains, err := node.GetAPIClient().PChainAPI().GetBlockchains(ctx) if err != nil { return err } - vdrs, err := node.GetAPIClient().PChainAPI().GetCurrentValidators(ctx, subnetID, nil) + for _, blockchain := range blockchains { + if blockchain.Name == "C-Chain" || blockchain.Name == "X-Chain" { + continue + } + lc.customChainIDToInfo[blockchain.ID] = chainInfo{ + info: &rpcpb.CustomChainInfo{ + ChainName: blockchain.Name, + VmId: blockchain.VMID.String(), + SubnetId: blockchain.SubnetID.String(), + ChainId: blockchain.ID.String(), + }, + subnetID: blockchain.SubnetID, + blockchainID: blockchain.ID, + } + } + subnets, err := node.GetAPIClient().PChainAPI().GetSubnets(ctx, nil) if err != nil { return err } - var nodeNameList []string - - for _, node := range vdrs { - for nodeName, nodeInfo := range lc.nodeInfos { - if nodeInfo.Id == node.NodeID.String() { - nodeNameList = append(nodeNameList, nodeName) - } + subnetIDList := []string{} + for _, subnet := range subnets { + if subnet.ID != avago_constants.PlatformChainID { + subnetIDList = append(subnetIDList, subnet.ID.String()) } } - - isElastic := false - elasticSubnetID := ids.Empty - if _, _, err := node.GetAPIClient().PChainAPI().GetCurrentSupply(ctx, subnetID); err == nil { - isElastic = true - elasticSubnetID, err = lc.nw.GetElasticSubnetID(ctx, subnetID) + for _, subnetIDStr := range subnetIDList { + subnetID, err := ids.FromString(subnetIDStr) if err != nil { return err } - } + vdrs, err := node.GetAPIClient().PChainAPI().GetCurrentValidators(ctx, subnetID, nil) + if err != nil { + return err + } + var nodeNameList []string + + for _, node := range vdrs { + for nodeName, nodeInfo := range lc.nodeInfos { + if nodeInfo.Id == node.NodeID.String() { + nodeNameList = append(nodeNameList, nodeName) + } + } + } - lc.subnets[subnetIDStr] = &rpcpb.SubnetInfo{ - IsElastic: isElastic, - ElasticSubnetId: elasticSubnetID.String(), - SubnetParticipants: &rpcpb.SubnetParticipants{NodeNames: nodeNameList}, + isElastic := false + elasticSubnetID := ids.Empty + if _, _, err := node.GetAPIClient().PChainAPI().GetCurrentSupply(ctx, subnetID); err == nil { + isElastic = true + elasticSubnetID, err = lc.nw.GetElasticSubnetID(ctx, subnetID) + if err != nil { + return err + } + } + + lc.subnets[subnetIDStr] = &rpcpb.SubnetInfo{ + IsElastic: isElastic, + ElasticSubnetId: elasticSubnetID.String(), + SubnetParticipants: &rpcpb.SubnetParticipants{NodeNames: nodeNameList}, + } } }