Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save node pub info when running keygen #164

Merged
merged 5 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cmd/bootstrap/cmd/keygen.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ var keygenCmd = &cobra.Command{

// create keys
log.Info().Msg("generating internal private networking and staking keys")
nodes := genNetworkAndStakingKeys([]model.NodeInfo{})
nodes := genNetworkAndStakingKeys()
log.Info().Msg("")

// count roles
roleCounts := nodeCountByRole(nodes)
for role, count := range roleCounts {
log.Info().Msg(fmt.Sprintf("created keys for %d %s nodes", count, role.String()))
}

log.Info().Msg("generating node public information")
genNodePubInfo(nodes)
},
}

Expand Down Expand Up @@ -74,3 +77,11 @@ func isEmptyDir(path string) (bool, error) {
}
return false, err // Either not empty or error, suits both cases
}

func genNodePubInfo(nodes []model.NodeInfo) {
pubNodes := make([]model.NodeInfoPub, 0, len(nodes))
for _, node := range nodes {
pubNodes = append(pubNodes, node.Public())
}
writeJSON(model.PathInternalNodeInfosPub, pubNodes)
}
2 changes: 1 addition & 1 deletion cmd/bootstrap/cmd/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/onflow/flow-go/model/flow"
)

func genNetworkAndStakingKeys(partnerNodes []model.NodeInfo) []model.NodeInfo {
func genNetworkAndStakingKeys() []model.NodeInfo {

var nodeConfigs []model.NodeConfig
readJSON(flagConfig, &nodeConfigs)
Expand Down
1 change: 1 addition & 0 deletions model/bootstrap/filenames.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var (

// public genesis information
DirnamePublicBootstrap = "public-root-information"
PathInternalNodeInfosPub = filepath.Join(DirnamePublicBootstrap, "node-internal-infos.pub.json")
PathNodeInfosPub = filepath.Join(DirnamePublicBootstrap, "node-infos.pub.json")
PathPartnerNodeInfoPrefix = filepath.Join(DirnamePublicBootstrap, "node-info.pub.")
PathNodeInfoPub = filepath.Join(DirnamePublicBootstrap, "node-info.pub.%v.json") // %v will be replaced by NodeID
Expand Down