genesis: support genesis creation under specific folder
This commit is contained in:
parent
1139e3e983
commit
b226460511
|
@ -64,11 +64,7 @@ func New(options ...Option) *core.Genesis {
|
|||
return genesis
|
||||
}
|
||||
|
||||
func NewFile(isQuorum bool, options ...Option) string {
|
||||
dir, err := generateRandomDir()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create random directory, err: %v", err)
|
||||
}
|
||||
func NewFileAt(dir string, isQuorum bool, options ...Option) string {
|
||||
genesis := New(options...)
|
||||
if err := Save(dir, genesis, isQuorum); err != nil {
|
||||
log.Fatalf("Failed to save genesis to '%s', err: %v", dir, err)
|
||||
|
@ -77,6 +73,14 @@ func NewFile(isQuorum bool, options ...Option) string {
|
|||
return filepath.Join(dir, FileName)
|
||||
}
|
||||
|
||||
func NewFile(isQuorum bool, options ...Option) string {
|
||||
dir, err := generateRandomDir()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create random directory, err: %v", err)
|
||||
}
|
||||
return NewFileAt(dir, isQuorum, options...)
|
||||
}
|
||||
|
||||
func Save(dataDir string, genesis *core.Genesis, isQuorum bool) error {
|
||||
filePath := filepath.Join(dataDir, FileName)
|
||||
|
||||
|
|
Loading…
Reference in New Issue