github.com/koko1123/flow-go-1@v0.29.6/cmd/bootstrap/run/cluster_block.go (about)

     1  package run
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/koko1123/flow-go-1/model/cluster"
     7  	"github.com/koko1123/flow-go-1/model/flow"
     8  	clusterstate "github.com/koko1123/flow-go-1/state/cluster"
     9  )
    10  
    11  func GenerateRootClusterBlocks(epoch uint64, clusters flow.ClusterList) []*cluster.Block {
    12  	clusterBlocks := make([]*cluster.Block, len(clusters))
    13  	for i := range clusterBlocks {
    14  		cluster, ok := clusters.ByIndex(uint(i))
    15  		if !ok {
    16  			panic(fmt.Sprintf("failed to get cluster by index: %v", i))
    17  		}
    18  
    19  		clusterBlocks[i] = clusterstate.CanonicalRootBlock(epoch, cluster)
    20  	}
    21  	return clusterBlocks
    22  }