summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTsachi Herman <tsachi.herman@algorand.com>2021-12-13 15:37:18 -0500
committerGitHub <noreply@github.com>2021-12-13 15:37:18 -0500
commit6330862d59d5cd7193c2bd42e871f038481e3a31 (patch)
tree90cbba85c74158e7f2c7bafd24fbf25377b93637
parent18cd6cda606c7d035bed4d2cfefaf4f25d009fa3 (diff)
Avoid creating algod process for the sole purpose of retrieving the genesis-id. (#3308)
## Summary Avoid creating algod process for the sole purpose of retrieving the genesis-id. Existing code was calling `algod -G -d <data dir>` in order to obtain the genesis version string. The genesis version string can be easily retrieved by loading the genesis file. ## Test Plan Use existing e2e tests.
-rw-r--r--netdeploy/networkTemplate.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/netdeploy/networkTemplate.go b/netdeploy/networkTemplate.go
index ecc7affdc..851644802 100644
--- a/netdeploy/networkTemplate.go
+++ b/netdeploy/networkTemplate.go
@@ -29,6 +29,7 @@ import (
"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
+ "github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/gen"
"github.com/algorand/go-algorand/libgoal"
"github.com/algorand/go-algorand/netdeploy/remote"
@@ -59,13 +60,13 @@ func (t NetworkTemplate) createNodeDirectories(targetFolder string, binDir strin
genesisFile := filepath.Join(targetFolder, genesisFileName)
nodeDirs = make(map[string]string)
- getGenesisVerCmd := filepath.Join(binDir, "algod")
importKeysCmd := filepath.Join(binDir, "goal")
- genesisVer, _, err := util.ExecAndCaptureOutput(getGenesisVerCmd, "-G", "-d", targetFolder)
+
+ genesis, err := bookkeeping.LoadGenesisFromFile(filepath.Join(targetFolder, "genesis.json"))
if err != nil {
return
}
- genesisVer = strings.TrimSpace(genesisVer)
+ genesisVer := genesis.ID()
relaysCount := countRelayNodes(t.Nodes)