|
@@ -18,7 +18,9 @@ package main
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"bytes"
|
|
"bytes"
|
|
|
|
|
+ "encoding/json"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
|
|
+ "io/ioutil"
|
|
|
"math/big"
|
|
"math/big"
|
|
|
"math/rand"
|
|
"math/rand"
|
|
|
"time"
|
|
"time"
|
|
@@ -135,3 +137,53 @@ func (w *wizard) makeGenesis() {
|
|
|
// All done, store the genesis and flush to disk
|
|
// All done, store the genesis and flush to disk
|
|
|
w.conf.genesis = genesis
|
|
w.conf.genesis = genesis
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// manageGenesis permits the modification of chain configuration parameters in
|
|
|
|
|
+// a genesis config and the export of the entire genesis spec.
|
|
|
|
|
+func (w *wizard) manageGenesis() {
|
|
|
|
|
+ // Figure out whether to modify or export the genesis
|
|
|
|
|
+ fmt.Println()
|
|
|
|
|
+ fmt.Println(" 1. Modify existing fork rules")
|
|
|
|
|
+ fmt.Println(" 2. Export genesis configuration")
|
|
|
|
|
+
|
|
|
|
|
+ choice := w.read()
|
|
|
|
|
+ switch {
|
|
|
|
|
+ case choice == "1":
|
|
|
|
|
+ // Fork rule updating requested, iterate over each fork
|
|
|
|
|
+ fmt.Println()
|
|
|
|
|
+ fmt.Printf("Which block should Homestead come into effect? (default = %v)\n", w.conf.genesis.Config.HomesteadBlock)
|
|
|
|
|
+ w.conf.genesis.Config.HomesteadBlock = w.readDefaultBigInt(w.conf.genesis.Config.HomesteadBlock)
|
|
|
|
|
+
|
|
|
|
|
+ fmt.Println()
|
|
|
|
|
+ fmt.Printf("Which block should EIP150 come into effect? (default = %v)\n", w.conf.genesis.Config.EIP150Block)
|
|
|
|
|
+ w.conf.genesis.Config.EIP150Block = w.readDefaultBigInt(w.conf.genesis.Config.EIP150Block)
|
|
|
|
|
+
|
|
|
|
|
+ fmt.Println()
|
|
|
|
|
+ fmt.Printf("Which block should EIP155 come into effect? (default = %v)\n", w.conf.genesis.Config.EIP155Block)
|
|
|
|
|
+ w.conf.genesis.Config.EIP155Block = w.readDefaultBigInt(w.conf.genesis.Config.EIP155Block)
|
|
|
|
|
+
|
|
|
|
|
+ fmt.Println()
|
|
|
|
|
+ fmt.Printf("Which block should EIP158 come into effect? (default = %v)\n", w.conf.genesis.Config.EIP158Block)
|
|
|
|
|
+ w.conf.genesis.Config.EIP158Block = w.readDefaultBigInt(w.conf.genesis.Config.EIP158Block)
|
|
|
|
|
+
|
|
|
|
|
+ fmt.Println()
|
|
|
|
|
+ fmt.Printf("Which block should Byzantium come into effect? (default = %v)\n", w.conf.genesis.Config.ByzantiumBlock)
|
|
|
|
|
+ w.conf.genesis.Config.ByzantiumBlock = w.readDefaultBigInt(w.conf.genesis.Config.ByzantiumBlock)
|
|
|
|
|
+
|
|
|
|
|
+ out, _ := json.MarshalIndent(w.conf.genesis.Config, "", " ")
|
|
|
|
|
+ fmt.Printf("Chain configuration updated:\n\n%s\n", out)
|
|
|
|
|
+
|
|
|
|
|
+ case choice == "2":
|
|
|
|
|
+ // Save whatever genesis configuration we currently have
|
|
|
|
|
+ fmt.Println()
|
|
|
|
|
+ fmt.Printf("Which file to save the genesis into? (default = %s.json)\n", w.network)
|
|
|
|
|
+ out, _ := json.MarshalIndent(w.conf.genesis, "", " ")
|
|
|
|
|
+ if err := ioutil.WriteFile(w.readDefaultString(fmt.Sprintf("%s.json", w.network)), out, 0644); err != nil {
|
|
|
|
|
+ log.Error("Failed to save genesis file", "err", err)
|
|
|
|
|
+ }
|
|
|
|
|
+ log.Info("Exported existing genesis block")
|
|
|
|
|
+
|
|
|
|
|
+ default:
|
|
|
|
|
+ log.Error("That's not something I can do")
|
|
|
|
|
+ }
|
|
|
|
|
+}
|