Skip to content

Commit 2014626

Browse files
committed
add aliases when loading snapshot
1 parent ea4f2b1 commit 2014626

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

local/snapshot.go

+22-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,28 @@ func (ln *localNetwork) loadSnapshot(
329329
ln.subnetID2ElasticSubnetID[subnetID] = elasticSubnetID
330330
}
331331
}
332-
return ln.loadConfig(ctx, networkConfig)
332+
if err := ln.loadConfig(ctx, networkConfig); err != nil {
333+
return err
334+
}
335+
if err := ln.healthy(ctx); err != nil {
336+
return err
337+
}
338+
node := ln.getNode()
339+
blockchains, err := node.GetAPIClient().PChainAPI().GetBlockchains(ctx)
340+
if err != nil {
341+
return err
342+
}
343+
for _, blockchain := range blockchains {
344+
if blockchain.Name == "C-Chain" || blockchain.Name == "X-Chain" {
345+
continue
346+
}
347+
for nodeName, node := range ln.nodes {
348+
if err := node.client.AdminAPI().AliasChain(ctx, blockchain.ID.String(), blockchain.Name); err != nil {
349+
return fmt.Errorf("failure to register blockchain alias %v on node %v: %w", blockchain.Name, nodeName, err)
350+
}
351+
}
352+
}
353+
return nil
333354
}
334355

335356
// Remove network snapshot

0 commit comments

Comments
 (0)