diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-08-06 00:08:52 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-08-06 00:08:52 +0800 |
commit | 80e5f507130a926ea62dde07c2b98d6f8a0ba3e2 (patch) | |
tree | 750fe404c14b6f5e8ef03a07cf3357787c6c9683 /cmd/geth | |
parent | 98f4c936f25de27dbc90f36f2c1ffd1f23b114e9 (diff) | |
parent | 26f838796b8793f38268f3a8911ec2b71913153c (diff) | |
download | dexon-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar dexon-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar.gz dexon-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar.bz2 dexon-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar.lz dexon-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar.xz dexon-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar.zst dexon-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.zip |
Merge branch 'develop'
Diffstat (limited to 'cmd/geth')
-rw-r--r-- | cmd/geth/blocktestcmd.go | 4 | ||||
-rw-r--r-- | cmd/geth/chaincmd.go | 4 | ||||
-rw-r--r-- | cmd/geth/js.go | 23 | ||||
-rw-r--r-- | cmd/geth/js_test.go | 13 | ||||
-rw-r--r-- | cmd/geth/main.go | 45 | ||||
-rw-r--r-- | cmd/geth/monitorcmd.go | 4 |
6 files changed, 73 insertions, 20 deletions
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..2d8eb15c2 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 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 db2c5ca03..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 @@ -37,6 +37,7 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth" + "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" ) @@ -89,9 +90,9 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *eth t.Fatal(err) } - // set up mock genesis with balance on the testAddress - core.GenesisAccounts = []byte(testGenesis) + db, _ := ethdb.NewMemDatabase() + core.WriteGenesisBlockForTesting(db, common.HexToAddress(testAddress), common.String2Big(testBalance)) ks := crypto.NewKeyStorePlain(filepath.Join(tmp, "keystore")) am := accounts.NewManager(ks) conf := ð.Config{ @@ -102,6 +103,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *eth Name: "test", SolcPath: testSolcPath, PowTest: true, + NewDB: func(path string) (common.Database, error) { return db, nil }, } if config != nil { config(conf) @@ -157,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) @@ -168,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 3805f3386..00dd8f753 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,6 +38,7 @@ 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" @@ -49,7 +50,7 @@ import ( const ( ClientIdentifier = "Geth" - Version = "0.9.38" + Version = "1.0.0" ) var ( @@ -276,10 +277,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, @@ -344,6 +347,11 @@ func main() { } 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) ethereum, err := eth.New(cfg) if err != nil { @@ -356,6 +364,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 { @@ -394,6 +404,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 { @@ -432,6 +444,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 { @@ -457,6 +471,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 { @@ -480,13 +496,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) } @@ -513,6 +533,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, " ") @@ -543,6 +566,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 { @@ -591,6 +616,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) @@ -601,6 +628,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 { @@ -616,6 +645,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") @@ -636,6 +667,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") @@ -650,6 +683,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 |