Skip to content

Commit

Permalink
starting a fuji node: ok
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemadero committed Jul 27, 2024
1 parent da99346 commit c3ad48a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 55 deletions.
2 changes: 1 addition & 1 deletion cmd/control/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
106 changes: 52 additions & 54 deletions server/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
}
}
}

Expand Down

0 comments on commit c3ad48a

Please sign in to comment.