Skip to content

Commit

Permalink
add aliases when loading snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemadero committed Apr 10, 2024
1 parent ea4f2b1 commit 2014626
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion local/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,28 @@ func (ln *localNetwork) loadSnapshot(
ln.subnetID2ElasticSubnetID[subnetID] = elasticSubnetID
}
}
return ln.loadConfig(ctx, networkConfig)
if err := ln.loadConfig(ctx, networkConfig); err != nil {
return err
}
if err := ln.healthy(ctx); err != nil {
return err
}
node := ln.getNode()
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
}
for nodeName, node := range ln.nodes {
if err := node.client.AdminAPI().AliasChain(ctx, blockchain.ID.String(), blockchain.Name); err != nil {
return fmt.Errorf("failure to register blockchain alias %v on node %v: %w", blockchain.Name, nodeName, err)
}
}
}
return nil
}

// Remove network snapshot
Expand Down

0 comments on commit 2014626

Please sign in to comment.