aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/puppeth/wizard.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-10-06 00:40:25 +0800
committerGitHub <noreply@github.com>2017-10-06 00:40:25 +0800
commit4bc60e3aa8eb3929a4e040ef260807a36e3db1d8 (patch)
tree287222764a4d7295fd28d51b97325c2fd4d54041 /cmd/puppeth/wizard.go
parenteb9abbd3f2e48c1106343c06bd3f6fb460d0dd12 (diff)
parentedba5e9854dcef9b4dcb6d75c06d5b5c7e5b8856 (diff)
downloaddexon-4bc60e3aa8eb3929a4e040ef260807a36e3db1d8.tar
dexon-4bc60e3aa8eb3929a4e040ef260807a36e3db1d8.tar.gz
dexon-4bc60e3aa8eb3929a4e040ef260807a36e3db1d8.tar.bz2
dexon-4bc60e3aa8eb3929a4e040ef260807a36e3db1d8.tar.lz
dexon-4bc60e3aa8eb3929a4e040ef260807a36e3db1d8.tar.xz
dexon-4bc60e3aa8eb3929a4e040ef260807a36e3db1d8.tar.zst
dexon-4bc60e3aa8eb3929a4e040ef260807a36e3db1d8.zip
Merge pull request #15241 from karalabe/puppeth-fork-management
cmd/puppeth: support managing fork block in the chain config
Diffstat (limited to 'cmd/puppeth/wizard.go')
-rw-r--r--cmd/puppeth/wizard.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/cmd/puppeth/wizard.go b/cmd/puppeth/wizard.go
index 518741279..3fdd639f8 100644
--- a/cmd/puppeth/wizard.go
+++ b/cmd/puppeth/wizard.go
@@ -161,6 +161,28 @@ func (w *wizard) readDefaultInt(def int) int {
}
}
+// readDefaultBigInt reads a single line from stdin, trimming if from spaces,
+// enforcing it to parse into a big integer. If an empty line is entered, the
+// default value is returned.
+func (w *wizard) readDefaultBigInt(def *big.Int) *big.Int {
+ for {
+ fmt.Printf("> ")
+ text, err := w.in.ReadString('\n')
+ if err != nil {
+ log.Crit("Failed to read user input", "err", err)
+ }
+ if text = strings.TrimSpace(text); text == "" {
+ return def
+ }
+ val, ok := new(big.Int).SetString(text, 0)
+ if !ok {
+ log.Error("Invalid input, expected big integer")
+ continue
+ }
+ return val
+ }
+}
+
/*
// readFloat reads a single line from stdin, trimming if from spaces, enforcing it
// to parse into a float.