aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/LICENSE16
-rw-r--r--cmd/bootnode/main.go4
-rw-r--r--cmd/disasm/main.go4
-rw-r--r--cmd/ethtest/main.go26
-rw-r--r--cmd/evm/main.go139
-rw-r--r--cmd/geth/blocktestcmd.go4
-rw-r--r--cmd/geth/chaincmd.go30
-rw-r--r--cmd/geth/js.go23
-rw-r--r--cmd/geth/js_test.go7
-rw-r--r--cmd/geth/main.go78
-rw-r--r--cmd/geth/monitorcmd.go4
-rw-r--r--cmd/rlpdump/main.go4
-rw-r--r--cmd/utils/cmd.go54
-rw-r--r--cmd/utils/customflags.go13
-rw-r--r--cmd/utils/customflags_test.go9
-rw-r--r--cmd/utils/flags.go79
-rw-r--r--cmd/utils/legalese.go41
17 files changed, 387 insertions, 148 deletions
diff --git a/cmd/LICENSE b/cmd/LICENSE
deleted file mode 100644
index 00cdb415d..000000000
--- a/cmd/LICENSE
+++ /dev/null
@@ -1,16 +0,0 @@
-Copyright (c) 2013-2015, The go-ethereum Authors. All rights reserved.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-MA 02110-1301 USA
diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go
index 397fa099c..0cad5321b 100644
--- a/cmd/bootnode/main.go
+++ b/cmd/bootnode/main.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// bootnode runs a bootstrap node for the Ethereum Discovery Protocol.
package main
diff --git a/cmd/disasm/main.go b/cmd/disasm/main.go
index 4bcd8608a..ba1295ba1 100644
--- a/cmd/disasm/main.go
+++ b/cmd/disasm/main.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// disasm is a pretty-printer for EVM bytecode.
package main
diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go
index 61276b177..67b965396 100644
--- a/cmd/ethtest/main.go
+++ b/cmd/ethtest/main.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// ethtest executes Ethereum JSON tests.
package main
@@ -26,6 +26,7 @@ import (
"strings"
"github.com/codegangsta/cli"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/tests"
)
@@ -35,7 +36,8 @@ var (
testExtension = ".json"
defaultTest = "all"
defaultDir = "."
- allTests = []string{"BlockTests", "StateTests", "TransactionTests", "VMTests"}
+ allTests = []string{"BlockTests", "StateTests", "TransactionTests", "VMTests", "RLPTests"}
+ testDirMapping = map[string]string{"BlockTests": "BlockchainTests"}
skipTests = []string{}
TestFlag = cli.StringFlag{
@@ -61,6 +63,10 @@ var (
Name: "skip",
Usage: "Tests names to skip",
}
+ TraceFlag = cli.BoolFlag{
+ Name: "trace",
+ Usage: "Enable VM tracing",
+ }
)
func runTestWithReader(test string, r io.Reader) error {
@@ -75,6 +81,8 @@ func runTestWithReader(test string, r io.Reader) error {
err = tests.RunTransactionTestsWithReader(r, skipTests)
case "vm", "vmtest", "vmtests":
err = tests.RunVmTestWithReader(r, skipTests)
+ case "rlp", "rlptest", "rlptests":
+ err = tests.RunRLPTestWithReader(r, skipTests)
default:
err = fmt.Errorf("Invalid test type specified: %v", test)
}
@@ -133,8 +141,13 @@ func runSuite(test, file string) {
var err error
var files []string
if test == defaultTest {
- files, err = getFiles(filepath.Join(file, curTest))
-
+ // check if we have an explicit directory mapping for the test
+ if _, ok := testDirMapping[curTest]; ok {
+ files, err = getFiles(filepath.Join(file, testDirMapping[curTest]))
+ } else {
+ // otherwise assume test name
+ files, err = getFiles(filepath.Join(file, curTest))
+ }
} else {
files, err = getFiles(file)
}
@@ -165,7 +178,6 @@ func runSuite(test, file string) {
glog.Fatalln(err)
}
}
-
}
}
}
@@ -176,6 +188,7 @@ func setupApp(c *cli.Context) {
continueOnError = c.GlobalBool(ContinueOnErrorFlag.Name)
useStdIn := c.GlobalBool(ReadStdInFlag.Name)
skipTests = strings.Split(c.GlobalString(SkipTestsFlag.Name), " ")
+ vm.Debug = c.GlobalBool(TraceFlag.Name)
if !useStdIn {
runSuite(flagTest, flagFile)
@@ -203,6 +216,7 @@ func main() {
ContinueOnErrorFlag,
ReadStdInFlag,
SkipTestsFlag,
+ TraceFlag,
}
if err := app.Run(os.Args); err != nil {
diff --git a/cmd/evm/main.go b/cmd/evm/main.go
index 6420c83be..be6546c95 100644
--- a/cmd/evm/main.go
+++ b/cmd/evm/main.go
@@ -8,89 +8,153 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// evm executes EVM code snippets.
package main
import (
- "flag"
"fmt"
- "log"
"math/big"
"os"
"runtime"
"time"
+ "github.com/codegangsta/cli"
+ "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
- "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger/glog"
)
var (
- code = flag.String("code", "", "evm code")
- loglevel = flag.Int("log", 4, "log level")
- gas = flag.String("gas", "1000000000", "gas amount")
- price = flag.String("price", "0", "gas price")
- value = flag.String("value", "0", "tx value")
- dump = flag.Bool("dump", false, "dump state after run")
- data = flag.String("data", "", "data")
+ app *cli.App
+ DebugFlag = cli.BoolFlag{
+ Name: "debug",
+ Usage: "output full trace logs",
+ }
+ ForceJitFlag = cli.BoolFlag{
+ Name: "forcejit",
+ Usage: "forces jit compilation",
+ }
+ DisableJitFlag = cli.BoolFlag{
+ Name: "nojit",
+ Usage: "disabled jit compilation",
+ }
+ CodeFlag = cli.StringFlag{
+ Name: "code",
+ Usage: "EVM code",
+ }
+ GasFlag = cli.StringFlag{
+ Name: "gas",
+ Usage: "gas limit for the evm",
+ Value: "10000000000",
+ }
+ PriceFlag = cli.StringFlag{
+ Name: "price",
+ Usage: "price set for the evm",
+ Value: "0",
+ }
+ ValueFlag = cli.StringFlag{
+ Name: "value",
+ Usage: "value set for the evm",
+ Value: "0",
+ }
+ DumpFlag = cli.BoolFlag{
+ Name: "dump",
+ Usage: "dumps the state after the run",
+ }
+ InputFlag = cli.StringFlag{
+ Name: "input",
+ Usage: "input for the EVM",
+ }
+ SysStatFlag = cli.BoolFlag{
+ Name: "sysstat",
+ Usage: "display system stats",
+ }
)
-func perr(v ...interface{}) {
- fmt.Println(v...)
- //os.Exit(1)
+func init() {
+ app = utils.NewApp("0.2", "the evm command line interface")
+ app.Flags = []cli.Flag{
+ DebugFlag,
+ ForceJitFlag,
+ DisableJitFlag,
+ SysStatFlag,
+ CodeFlag,
+ GasFlag,
+ PriceFlag,
+ ValueFlag,
+ DumpFlag,
+ InputFlag,
+ }
+ app.Action = run
}
-func main() {
- flag.Parse()
+func run(ctx *cli.Context) {
+ vm.Debug = ctx.GlobalBool(DebugFlag.Name)
+ vm.ForceJit = ctx.GlobalBool(ForceJitFlag.Name)
+ vm.DisableJit = ctx.GlobalBool(DisableJitFlag.Name)
- logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.LogLevel(*loglevel)))
+ glog.SetToStderr(true)
- vm.Debug = true
db, _ := ethdb.NewMemDatabase()
statedb := state.New(common.Hash{}, db)
sender := statedb.CreateAccount(common.StringToAddress("sender"))
receiver := statedb.CreateAccount(common.StringToAddress("receiver"))
- receiver.SetCode(common.Hex2Bytes(*code))
+ receiver.SetCode(common.Hex2Bytes(ctx.GlobalString(CodeFlag.Name)))
- vmenv := NewEnv(statedb, common.StringToAddress("evmuser"), common.Big(*value))
+ vmenv := NewEnv(statedb, common.StringToAddress("evmuser"), common.Big(ctx.GlobalString(ValueFlag.Name)))
tstart := time.Now()
-
- ret, e := vmenv.Call(sender, receiver.Address(), common.Hex2Bytes(*data), common.Big(*gas), common.Big(*price), common.Big(*value))
-
- logger.Flush()
- if e != nil {
- perr(e)
- }
-
- if *dump {
+ ret, e := vmenv.Call(
+ sender,
+ receiver.Address(),
+ common.Hex2Bytes(ctx.GlobalString(InputFlag.Name)),
+ common.Big(ctx.GlobalString(GasFlag.Name)),
+ common.Big(ctx.GlobalString(PriceFlag.Name)),
+ common.Big(ctx.GlobalString(ValueFlag.Name)),
+ )
+ vmdone := time.Since(tstart)
+
+ if ctx.GlobalBool(DumpFlag.Name) {
fmt.Println(string(statedb.Dump()))
}
-
vm.StdErrFormat(vmenv.StructLogs())
- var mem runtime.MemStats
- runtime.ReadMemStats(&mem)
- fmt.Printf("vm took %v\n", time.Since(tstart))
- fmt.Printf(`alloc: %d
+ if ctx.GlobalBool(SysStatFlag.Name) {
+ var mem runtime.MemStats
+ runtime.ReadMemStats(&mem)
+ fmt.Printf("vm took %v\n", vmdone)
+ fmt.Printf(`alloc: %d
tot alloc: %d
no. malloc: %d
heap alloc: %d
heap objs: %d
num gc: %d
`, mem.Alloc, mem.TotalAlloc, mem.Mallocs, mem.HeapAlloc, mem.HeapObjects, mem.NumGC)
+ }
- fmt.Printf("%x\n", ret)
+ fmt.Printf("OUT: 0x%x", ret)
+ if e != nil {
+ fmt.Printf(" error: %v", e)
+ }
+ fmt.Println()
+}
+
+func main() {
+ if err := app.Run(os.Args); err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ os.Exit(1)
+ }
}
type VMEnv struct {
@@ -142,6 +206,9 @@ func (self *VMEnv) StructLogs() []vm.StructLog {
func (self *VMEnv) AddLog(log *state.Log) {
self.state.AddLog(log)
}
+func (self *VMEnv) CanTransfer(from vm.Account, balance *big.Int) bool {
+ return from.Balance().Cmp(balance) >= 0
+}
func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
return vm.Transfer(from, to, amount)
}
diff --git a/cmd/geth/blocktestcmd.go b/cmd/geth/blocktestcmd.go
index 494a4d474..4eff82e3d 100644
--- a/cmd/geth/blocktestcmd.go
+++ b/cmd/geth/blocktestcmd.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go
index b23a74809..876b8c6ba 100644
--- a/cmd/geth/chaincmd.go
+++ b/cmd/geth/chaincmd.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
@@ -74,10 +74,10 @@ func importChain(ctx *cli.Context) {
if len(ctx.Args()) != 1 {
utils.Fatalf("This command requires an argument.")
}
- chain, blockDB, stateDB, extraDB := utils.MakeChain(ctx)
+ chain, chainDb := utils.MakeChain(ctx)
start := time.Now()
err := utils.ImportChain(chain, ctx.Args().First())
- closeAll(blockDB, stateDB, extraDB)
+ chainDb.Close()
if err != nil {
utils.Fatalf("Import error: %v", err)
}
@@ -88,7 +88,7 @@ func exportChain(ctx *cli.Context) {
if len(ctx.Args()) < 1 {
utils.Fatalf("This command requires an argument.")
}
- chain, _, _, _ := utils.MakeChain(ctx)
+ chain, _ := utils.MakeChain(ctx)
start := time.Now()
var err error
@@ -136,8 +136,8 @@ func removeDB(ctx *cli.Context) {
func upgradeDB(ctx *cli.Context) {
glog.Infoln("Upgrading blockchain database")
- chain, blockDB, stateDB, extraDB := utils.MakeChain(ctx)
- v, _ := blockDB.Get([]byte("BlockchainVersion"))
+ chain, chainDb := utils.MakeChain(ctx)
+ v, _ := chainDb.Get([]byte("BlockchainVersion"))
bcVersion := int(common.NewValue(v).Uint())
if bcVersion == 0 {
bcVersion = core.BlockChainVersion
@@ -149,15 +149,14 @@ func upgradeDB(ctx *cli.Context) {
if err := utils.ExportChain(chain, exportFile); err != nil {
utils.Fatalf("Unable to export chain for reimport %s", err)
}
- closeAll(blockDB, stateDB, extraDB)
- os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "blockchain"))
- os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "state"))
+ chainDb.Close()
+ os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "chaindata"))
// Import the chain file.
- chain, blockDB, stateDB, extraDB = utils.MakeChain(ctx)
- blockDB.Put([]byte("BlockchainVersion"), common.NewValue(core.BlockChainVersion).Bytes())
+ chain, chainDb = utils.MakeChain(ctx)
+ chainDb.Put([]byte("BlockchainVersion"), common.NewValue(core.BlockChainVersion).Bytes())
err := utils.ImportChain(chain, exportFile)
- closeAll(blockDB, stateDB, extraDB)
+ chainDb.Close()
if err != nil {
utils.Fatalf("Import error %v (a backup is made in %s, use the import command to import it)", err, exportFile)
} else {
@@ -167,7 +166,7 @@ func upgradeDB(ctx *cli.Context) {
}
func dump(ctx *cli.Context) {
- chain, _, stateDB, _ := utils.MakeChain(ctx)
+ chain, chainDb := utils.MakeChain(ctx)
for _, arg := range ctx.Args() {
var block *types.Block
if hashish(arg) {
@@ -180,10 +179,11 @@ func dump(ctx *cli.Context) {
fmt.Println("{}")
utils.Fatalf("block not found")
} else {
- state := state.New(block.Root(), stateDB)
+ state := state.New(block.Root(), chainDb)
fmt.Printf("%s\n", state.Dump())
}
}
+ chainDb.Close()
}
// hashish returns true for strings that look like hashes.
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index cc4c14c2e..bf56423ec 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
@@ -23,6 +23,7 @@ import (
"os"
"os/signal"
"path/filepath"
+ "regexp"
"strings"
"sort"
@@ -44,6 +45,10 @@ import (
"github.com/robertkrimen/otto"
)
+var passwordRegexp = regexp.MustCompile("personal.[nu]")
+
+const passwordRepl = ""
+
type prompter interface {
AppendHistory(string)
Prompt(p string) (string, error)
@@ -413,8 +418,10 @@ func (self *jsre) interactive() {
str += input + "\n"
self.setIndent()
if indentCount <= 0 {
- hist := str[:len(str)-1]
- self.AppendHistory(hist)
+ hist := hidepassword(str[:len(str)-1])
+ if len(hist) > 0 {
+ self.AppendHistory(hist)
+ }
self.parseInput(str)
str = ""
}
@@ -422,6 +429,14 @@ func (self *jsre) interactive() {
}
}
+func hidepassword(input string) string {
+ if passwordRegexp.MatchString(input) {
+ return passwordRepl
+ } else {
+ return input
+ }
+}
+
func (self *jsre) withHistory(op func(*os.File)) {
datadir := common.DefaultDataDir()
if self.ethereum != nil {
diff --git a/cmd/geth/js_test.go b/cmd/geth/js_test.go
index ffd164d27..67c36dfe7 100644
--- a/cmd/geth/js_test.go
+++ b/cmd/geth/js_test.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
@@ -159,7 +159,7 @@ func TestAccounts(t *testing.T) {
defer os.RemoveAll(tmp)
checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`"]`)
- checkEvalJSON(t, repl, `eth.coinbase`, `null`)
+ checkEvalJSON(t, repl, `eth.coinbase`, `"`+testAddress+`"`)
val, err := repl.re.Run(`personal.newAccount("password")`)
if err != nil {
t.Errorf("expected no error, got %v", err)
@@ -170,6 +170,7 @@ func TestAccounts(t *testing.T) {
}
checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`","`+addr+`"]`)
+
}
func TestBlockChain(t *testing.T) {
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 6acdff9ad..4905d502a 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// geth is the official command-line client for Ethereum.
package main
@@ -38,9 +38,12 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
+ "github.com/ethereum/go-ethereum/fdtrack"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/metrics"
+ "github.com/ethereum/go-ethereum/params"
+ "github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/comms"
"github.com/mattn/go-colorable"
@@ -49,11 +52,14 @@ import (
const (
ClientIdentifier = "Geth"
- Version = "0.9.39"
+ Version = "1.0.1"
+ VersionMajor = 1
+ VersionMinor = 0
+ VersionPatch = 1
)
var (
- gitCommit string // set via linker flag
+ gitCommit string // set via linker flagg
nodeNameVersion string
app *cli.App
)
@@ -276,11 +282,12 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.IdentityFlag,
utils.UnlockedAccountFlag,
utils.PasswordFileFlag,
- utils.GenesisNonceFlag,
utils.GenesisFileFlag,
utils.BootnodesFlag,
utils.DataDirFlag,
utils.BlockchainVersionFlag,
+ utils.OlympicFlag,
+ utils.CacheFlag,
utils.JSpathFlag,
utils.ListenPortFlag,
utils.MaxPeersFlag,
@@ -305,6 +312,9 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.ExecFlag,
utils.WhisperEnabledFlag,
utils.VMDebugFlag,
+ utils.VMForceJitFlag,
+ utils.VMJitCacheFlag,
+ utils.VMEnableJitFlag,
utils.NetworkIdFlag,
utils.RPCCORSDomainFlag,
utils.VerbosityFlag,
@@ -326,6 +336,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
}
app.Before = func(ctx *cli.Context) error {
utils.SetupLogger(ctx)
+ utils.SetupVM(ctx)
if ctx.GlobalBool(utils.PProfEanbledFlag.Name) {
utils.StartPProf(ctx)
}
@@ -344,8 +355,36 @@ func main() {
}
}
+func makeDefaultExtra() []byte {
+ var clientInfo = struct {
+ Version uint
+ Name string
+ GoVersion string
+ Os string
+ }{uint(VersionMajor<<16 | VersionMinor<<8 | VersionPatch), ClientIdentifier, runtime.Version(), runtime.GOOS}
+ extra, err := rlp.EncodeToBytes(clientInfo)
+ if err != nil {
+ glog.V(logger.Warn).Infoln("error setting canonical miner information:", err)
+ }
+
+ if uint64(len(extra)) > params.MaximumExtraDataSize.Uint64() {
+ glog.V(logger.Warn).Infoln("error setting canonical miner information: extra exceeds", params.MaximumExtraDataSize)
+ glog.V(logger.Debug).Infof("extra: %x\n", extra)
+ return nil
+ }
+
+ return extra
+}
+
func run(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+ if ctx.GlobalBool(utils.OlympicFlag.Name) {
+ utils.InitOlympic()
+ }
+
cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx)
+ cfg.ExtraData = makeDefaultExtra()
+
ethereum, err := eth.New(cfg)
if err != nil {
utils.Fatalf("%v", err)
@@ -357,6 +396,8 @@ func run(ctx *cli.Context) {
}
func attach(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
// Wrap the standard output with a colorified stream (windows)
if isatty.IsTerminal(os.Stdout.Fd()) {
if pr, pw, err := os.Pipe(); err == nil {
@@ -395,6 +436,8 @@ func attach(ctx *cli.Context) {
}
func console(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
// Wrap the standard output with a colorified stream (windows)
if isatty.IsTerminal(os.Stdout.Fd()) {
if pr, pw, err := os.Pipe(); err == nil {
@@ -433,6 +476,8 @@ func console(ctx *cli.Context) {
}
func execJSFiles(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx)
ethereum, err := eth.New(cfg)
if err != nil {
@@ -458,6 +503,8 @@ func execJSFiles(ctx *cli.Context) {
}
func unlockAccount(ctx *cli.Context, am *accounts.Manager, addr string, i int) (addrHex, auth string) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
var err error
addrHex, err = utils.ParamToAddress(addr, am)
if err == nil {
@@ -481,13 +528,17 @@ func unlockAccount(ctx *cli.Context, am *accounts.Manager, addr string, i int) (
}
func blockRecovery(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
arg := ctx.Args().First()
if len(ctx.Args()) < 1 && len(arg) > 0 {
glog.Fatal("recover requires block number or hash")
}
cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx)
- blockDb, err := ethdb.NewLDBDatabase(filepath.Join(cfg.DataDir, "blockchain"))
+ utils.CheckLegalese(cfg.DataDir)
+
+ blockDb, err := ethdb.NewLDBDatabase(filepath.Join(cfg.DataDir, "blockchain"), cfg.DatabaseCache)
if err != nil {
glog.Fatalln("could not open db:", err)
}
@@ -514,6 +565,9 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
// Start Ethereum itself
utils.StartEthereum(eth)
+ // Start logging file descriptor stats.
+ fdtrack.Start()
+
am := eth.AccountManager()
account := ctx.GlobalString(utils.UnlockedAccountFlag.Name)
accounts := strings.Split(account, " ")
@@ -544,6 +598,8 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
}
func accountList(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
am := utils.MakeAccountManager(ctx)
accts, err := am.Accounts()
if err != nil {
@@ -592,6 +648,8 @@ func getPassPhrase(ctx *cli.Context, desc string, confirmation bool, i int) (pas
}
func accountCreate(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
am := utils.MakeAccountManager(ctx)
passphrase := getPassPhrase(ctx, "Your new account is locked with a password. Please give a password. Do not forget this password.", true, 0)
acct, err := am.NewAccount(passphrase)
@@ -602,6 +660,8 @@ func accountCreate(ctx *cli.Context) {
}
func accountUpdate(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
am := utils.MakeAccountManager(ctx)
arg := ctx.Args().First()
if len(arg) == 0 {
@@ -617,6 +677,8 @@ func accountUpdate(ctx *cli.Context) {
}
func importWallet(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
keyfile := ctx.Args().First()
if len(keyfile) == 0 {
utils.Fatalf("keyfile must be given as argument")
@@ -637,6 +699,8 @@ func importWallet(ctx *cli.Context) {
}
func accountImport(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
keyfile := ctx.Args().First()
if len(keyfile) == 0 {
utils.Fatalf("keyfile must be given as argument")
@@ -651,6 +715,8 @@ func accountImport(ctx *cli.Context) {
}
func makedag(ctx *cli.Context) {
+ utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+
args := ctx.Args()
wrongArgs := func() {
utils.Fatalf(`Usage: geth makedag <block number> <outputdir>`)
diff --git a/cmd/geth/monitorcmd.go b/cmd/geth/monitorcmd.go
index affe3b75d..a7c099532 100644
--- a/cmd/geth/monitorcmd.go
+++ b/cmd/geth/monitorcmd.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
diff --git a/cmd/rlpdump/main.go b/cmd/rlpdump/main.go
index 2f74c073d..10eea1fde 100644
--- a/cmd/rlpdump/main.go
+++ b/cmd/rlpdump/main.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// rlpdump is a pretty-printer for RLP data.
package main
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index 2949d2470..983762db8 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// Package utils contains internal helper functions for go-ethereum commands.
package utils
@@ -21,6 +21,8 @@ import (
"bufio"
"fmt"
"io"
+ "math"
+ "math/big"
"os"
"os/signal"
"regexp"
@@ -32,6 +34,7 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/peterh/liner"
)
@@ -58,15 +61,16 @@ func PromptConfirm(prompt string) (bool, error) {
)
prompt = prompt + " [y/N] "
- if liner.TerminalSupported() {
- lr := liner.NewLiner()
- defer lr.Close()
- input, err = lr.Prompt(prompt)
- } else {
- fmt.Print(prompt)
- input, err = bufio.NewReader(os.Stdin).ReadString('\n')
- fmt.Println()
- }
+ // if liner.TerminalSupported() {
+ // fmt.Println("term")
+ // lr := liner.NewLiner()
+ // defer lr.Close()
+ // input, err = lr.Prompt(prompt)
+ // } else {
+ fmt.Print(prompt)
+ input, err = bufio.NewReader(os.Stdin).ReadString('\n')
+ fmt.Println()
+ // }
if len(input) > 0 && strings.ToUpper(input[:1]) == "Y" {
return true, nil
@@ -92,12 +96,12 @@ func PromptPassword(prompt string, warnTerm bool) (string, error) {
return input, err
}
-func initDataDir(Datadir string) {
- _, err := os.Stat(Datadir)
- if err != nil {
- if os.IsNotExist(err) {
- fmt.Printf("Data directory '%s' doesn't exist, creating it\n", Datadir)
- os.Mkdir(Datadir, 0777)
+func CheckLegalese(datadir string) {
+ // check "first run"
+ if !common.FileExist(datadir) {
+ r, _ := PromptConfirm(legalese)
+ if !r {
+ Fatalf("Must accept to continue. Shutting down...\n")
}
}
}
@@ -142,6 +146,16 @@ func StartEthereum(ethereum *eth.Ethereum) {
}()
}
+func InitOlympic() {
+ params.DurationLimit = big.NewInt(8)
+ params.GenesisGasLimit = big.NewInt(3141592)
+ params.MinGasLimit = big.NewInt(125000)
+ params.MaximumExtraDataSize = big.NewInt(1024)
+ NetworkIdFlag.Value = 0
+ core.BlockReward = big.NewInt(1.5e+18)
+ core.ExpDiffPeriod = big.NewInt(math.MaxInt64)
+}
+
func FormatTransactionData(data string) []byte {
d := common.StringToByteFunc(data, func(s string) (ret []byte) {
slice := regexp.MustCompile("\\n|\\s").Split(s, 1000000000)
@@ -202,6 +216,11 @@ func ImportChain(chain *core.ChainManager, fn string) error {
} else if err != nil {
return fmt.Errorf("at block %d: %v", n, err)
}
+ // don't import first block
+ if b.NumberU64() == 0 {
+ i--
+ continue
+ }
blocks[i] = &b
n++
}
@@ -217,6 +236,7 @@ func ImportChain(chain *core.ChainManager, fn string) error {
batch, blocks[0].Hash().Bytes()[:4], blocks[i-1].Hash().Bytes()[:4])
continue
}
+
if _, err := chain.InsertChain(blocks[:i]); err != nil {
return fmt.Errorf("invalid block %d: %v", n, err)
}
diff --git a/cmd/utils/customflags.go b/cmd/utils/customflags.go
index 6aeec448c..4450065c1 100644
--- a/cmd/utils/customflags.go
+++ b/cmd/utils/customflags.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package utils
@@ -21,7 +21,7 @@ import (
"fmt"
"os"
"os/user"
- "path/filepath"
+ "path"
"strings"
"github.com/codegangsta/cli"
@@ -138,11 +138,8 @@ func (self *DirectoryFlag) Set(value string) {
func expandPath(p string) string {
if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") {
if user, err := user.Current(); err == nil {
- if err == nil {
- p = strings.Replace(p, "~", user.HomeDir, 1)
- }
+ p = user.HomeDir + p[1:]
}
}
-
- return filepath.Clean(os.ExpandEnv(p))
+ return path.Clean(os.ExpandEnv(p))
}
diff --git a/cmd/utils/customflags_test.go b/cmd/utils/customflags_test.go
index 726d1ab47..de39ca36a 100644
--- a/cmd/utils/customflags_test.go
+++ b/cmd/utils/customflags_test.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package utils
@@ -23,18 +23,15 @@ import (
)
func TestPathExpansion(t *testing.T) {
-
user, _ := user.Current()
-
tests := map[string]string{
"/home/someuser/tmp": "/home/someuser/tmp",
"~/tmp": user.HomeDir + "/tmp",
+ "~thisOtherUser/b/": "~thisOtherUser/b",
"$DDDXXX/a/b": "/tmp/a/b",
"/a/b/": "/a/b",
}
-
os.Setenv("DDDXXX", "/tmp")
-
for test, expected := range tests {
got := expandPath(test)
if got != expected {
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 73bdb935a..462da9305 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package utils
@@ -27,6 +27,7 @@ import (
"runtime"
"strconv"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/metrics"
"github.com/codegangsta/cli"
@@ -126,6 +127,15 @@ var (
Name: "natspec",
Usage: "Enable NatSpec confirmation notice",
}
+ CacheFlag = cli.IntFlag{
+ Name: "cache",
+ Usage: "Megabytes of memory allocated to internal caching",
+ Value: 0,
+ }
+ OlympicFlag = cli.BoolFlag{
+ Name: "olympic",
+ Usage: "Use olympic style protocol",
+ }
// miner settings
MinerThreadsFlag = cli.IntFlag{
@@ -149,7 +159,7 @@ var (
GasPriceFlag = cli.StringFlag{
Name: "gasprice",
Usage: "Sets the minimal gasprice when mining transactions",
- Value: new(big.Int).Mul(big.NewInt(1), common.Szabo).String(),
+ Value: new(big.Int).Mul(big.NewInt(50), common.Shannon).String(),
}
UnlockedAccountFlag = cli.StringFlag{
@@ -163,6 +173,25 @@ var (
Value: "",
}
+ // vm flags
+ VMDebugFlag = cli.BoolFlag{
+ Name: "vmdebug",
+ Usage: "Virtual Machine debug output",
+ }
+ VMForceJitFlag = cli.BoolFlag{
+ Name: "forcejit",
+ Usage: "Force the JIT VM to take precedence",
+ }
+ VMJitCacheFlag = cli.IntFlag{
+ Name: "jitcache",
+ Usage: "Amount of cached JIT VM programs",
+ Value: 64,
+ }
+ VMEnableJitFlag = cli.BoolFlag{
+ Name: "jitvm",
+ Usage: "Enable the JIT VM",
+ }
+
// logging and debug settings
LogFileFlag = cli.StringFlag{
Name: "logfile",
@@ -187,10 +216,6 @@ var (
Usage: "The syntax of the argument is a comma-separated list of pattern=N, where pattern is a literal file name (minus the \".go\" suffix) or \"glob\" pattern and N is a log verbosity level.",
Value: glog.GetVModule(),
}
- VMDebugFlag = cli.BoolFlag{
- Name: "vmdebug",
- Usage: "Virtual Machine debug output",
- }
BacktraceAtFlag = cli.GenericFlag{
Name: "backtrace_at",
Usage: "If set to a file and line number (e.g., \"block.go:271\") holding a logging statement, a stack trace will be logged",
@@ -309,12 +334,12 @@ var (
GpoMinGasPriceFlag = cli.StringFlag{
Name: "gpomin",
Usage: "Minimum suggested gas price",
- Value: new(big.Int).Mul(big.NewInt(1), common.Szabo).String(),
+ Value: new(big.Int).Mul(big.NewInt(50), common.Shannon).String(),
}
GpoMaxGasPriceFlag = cli.StringFlag{
Name: "gpomax",
Usage: "Maximum suggested gas price",
- Value: new(big.Int).Mul(big.NewInt(100), common.Szabo).String(),
+ Value: new(big.Int).Mul(big.NewInt(500), common.Shannon).String(),
}
GpoFullBlockRatioFlag = cli.IntFlag{
Name: "gpofull",
@@ -384,6 +409,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
GenesisNonce: ctx.GlobalInt(GenesisNonceFlag.Name),
GenesisFile: ctx.GlobalString(GenesisFileFlag.Name),
BlockChainVersion: ctx.GlobalInt(BlockchainVersionFlag.Name),
+ DatabaseCache: ctx.GlobalInt(CacheFlag.Name),
SkipBcVersionCheck: false,
NetworkId: ctx.GlobalInt(NetworkIdFlag.Name),
LogFile: ctx.GlobalString(LogFileFlag.Name),
@@ -396,6 +422,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
MaxPendingPeers: ctx.GlobalInt(MaxPendingPeersFlag.Name),
Port: ctx.GlobalString(ListenPortFlag.Name),
+ Olympic: ctx.GlobalBool(OlympicFlag.Name),
NAT: MakeNAT(ctx),
NatSpec: ctx.GlobalBool(NatspecEnabledFlag.Name),
Discovery: !ctx.GlobalBool(NoDiscoverFlag.Name),
@@ -423,31 +450,41 @@ func SetupLogger(ctx *cli.Context) {
glog.SetLogDir(ctx.GlobalString(LogFileFlag.Name))
}
+// SetupVM configured the VM package's global settings
+func SetupVM(ctx *cli.Context) {
+ vm.DisableJit = !ctx.GlobalBool(VMEnableJitFlag.Name)
+ vm.ForceJit = ctx.GlobalBool(VMForceJitFlag.Name)
+ vm.SetJITCacheSize(ctx.GlobalInt(VMJitCacheFlag.Name))
+}
+
// MakeChain creates a chain manager from set command line flags.
-func MakeChain(ctx *cli.Context) (chain *core.ChainManager, blockDB, stateDB, extraDB common.Database) {
- dd := ctx.GlobalString(DataDirFlag.Name)
+func MakeChain(ctx *cli.Context) (chain *core.ChainManager, chainDb common.Database) {
+ datadir := ctx.GlobalString(DataDirFlag.Name)
+ cache := ctx.GlobalInt(CacheFlag.Name)
+
var err error
- if blockDB, err = ethdb.NewLDBDatabase(filepath.Join(dd, "blockchain")); err != nil {
+ if chainDb, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "chaindata"), cache); err != nil {
Fatalf("Could not open database: %v", err)
}
- if stateDB, err = ethdb.NewLDBDatabase(filepath.Join(dd, "state")); err != nil {
- Fatalf("Could not open database: %v", err)
- }
- if extraDB, err = ethdb.NewLDBDatabase(filepath.Join(dd, "extra")); err != nil {
- Fatalf("Could not open database: %v", err)
+ if ctx.GlobalBool(OlympicFlag.Name) {
+ InitOlympic()
+ _, err := core.WriteTestNetGenesisBlock(chainDb, 42)
+ if err != nil {
+ glog.Fatalln(err)
+ }
}
eventMux := new(event.TypeMux)
pow := ethash.New()
//genesis := core.GenesisBlock(uint64(ctx.GlobalInt(GenesisNonceFlag.Name)), blockDB)
- chain, err = core.NewChainManager(blockDB, stateDB, extraDB, pow, eventMux)
+ chain, err = core.NewChainManager(chainDb, pow, eventMux)
if err != nil {
Fatalf("Could not start chainmanager: %v", err)
}
- proc := core.NewBlockProcessor(stateDB, extraDB, pow, chain, eventMux)
+ proc := core.NewBlockProcessor(chainDb, pow, chain, eventMux)
chain.SetProcessor(proc)
- return chain, blockDB, stateDB, extraDB
+ return chain, chainDb
}
// MakeChain creates an account manager from set command line flags.
@@ -458,7 +495,7 @@ func MakeAccountManager(ctx *cli.Context) *accounts.Manager {
}
func IpcSocketPath(ctx *cli.Context) (ipcpath string) {
- if common.IsWindows() {
+ if runtime.GOOS == "windows" {
ipcpath = common.DefaultIpcPath()
if ctx.GlobalIsSet(IPCPathFlag.Name) {
ipcpath = ctx.GlobalString(IPCPathFlag.Name)
diff --git a/cmd/utils/legalese.go b/cmd/utils/legalese.go
new file mode 100644
index 000000000..09e687c17
--- /dev/null
+++ b/cmd/utils/legalese.go
@@ -0,0 +1,41 @@
+// Copyright 2015 The go-ethereum Authors
+// This file is part of go-ethereum.
+//
+// go-ethereum is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// go-ethereum is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+
+package utils
+
+const (
+ legalese = `
+=======================================
+Disclaimer of Liabilites and Warranties
+=======================================
+
+THE USER EXPRESSLY KNOWS AND AGREES THAT THE USER IS USING THE ETHEREUM PLATFORM AT THE USER’S SOLE
+RISK. THE USER REPRESENTS THAT THE USER HAS AN ADEQUATE UNDERSTANDING OF THE RISKS, USAGE AND
+INTRICACIES OF CRYPTOGRAPHIC TOKENS AND BLOCKCHAIN-BASED OPEN SOURCE SOFTWARE, ETH PLATFORM AND ETH.
+THE USER ACKNOWLEDGES AND AGREES THAT, TO THE FULLEST EXTENT PERMITTED BY ANY APPLICABLE LAW, THE
+DISCLAIMERS OF LIABILITY CONTAINED HEREIN APPLY TO ANY AND ALL DAMAGES OR INJURY WHATSOEVER CAUSED
+BY OR RELATED TO RISKS OF, USE OF, OR INABILITY TO USE, ETH OR THE ETHEREUM PLATFORM UNDER ANY CAUSE
+OR ACTION WHATSOEVER OF ANY KIND IN ANY JURISDICTION, INCLUDING, WITHOUT LIMITATION, ACTIONS FOR
+BREACH OF WARRANTY, BREACH OF CONTRACT OR TORT (INCLUDING NEGLIGENCE) AND THAT NEITHER STIFTUNG
+ETHEREUM NOR ETHEREUM TEAM SHALL BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR
+CONSEQUENTIAL DAMAGES, INCLUDING FOR LOSS OF PROFITS, GOODWILL OR DATA. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OF CERTAIN WARRANTIES OR THE LIMITATION OR EXCLUSION OF LIABILITY FOR CERTAIN
+TYPES OF DAMAGES. THEREFORE, SOME OF THE ABOVE LIMITATIONS IN THIS SECTION MAY NOT APPLY TO A USER.
+IN PARTICULAR, NOTHING IN THESE TERMS SHALL AFFECT THE STATUTORY RIGHTS OF ANY USER OR EXCLUDE
+INJURY ARISING FROM ANY WILLFUL MISCONDUCT OR FRAUD OF STIFTUNG ETHEREUM.
+
+Do you accept this agreement?`
+)