Skip to content

Commit 0f036f6

Browse files
committed
Merge branch 'release/1.4'
2 parents a269a71 + 71a89b7 commit 0f036f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3150
-2181
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ and help.
88
## Contributing
99

1010
If you'd like to contribute to go-ethereum please fork, fix, commit and
11-
send a pull request. Commits who do not comply with the coding standards
11+
send a pull request. Commits which do not comply with the coding standards
1212
are ignored (use gofmt!). If you send pull requests make absolute sure that you
1313
commit on the `develop` branch and that you do not merge to master.
1414
Commits that are directly based on master are simply ignored.

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
language: go
22
go:
33
- 1.4.2
4+
- 1.5.4
5+
- 1.6.2
46
install:
57
# - go get code.google.com/p/go.tools/cmd/goimports
68
# - go get github.com/golang/lint/golint
7-
# - go get golang.org/x/tools/cmd/vet
9+
# - go get golang.org/x/tools/cmd/vet
810
- go get golang.org/x/tools/cmd/cover
911
before_script:
1012
# - gofmt -l -w .
@@ -24,6 +26,6 @@ notifications:
2426
webhooks:
2527
urls:
2628
- https://webhooks.gitter.im/e/e09ccdce1048c5e03445
27-
on_success: change
29+
on_success: change
2830
on_failure: always
29-
on_start: false
31+
on_start: false

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Once the dependencies are installed, run
3636

3737
make geth
3838

39+
or, to build the full suite of utilities:
40+
41+
make all
42+
3943
## Executables
4044

4145
The go-ethereum project comes with several wrappers/executables found in the `cmd` directory.
@@ -58,14 +62,14 @@ anyone on the internet, and are grateful for even the smallest of fixes!
5862
If you'd like to contribute to go-ethereum, please fork, fix, commit and send a pull request
5963
for the maintainers to review and merge into the main code base. If you wish to submit more
6064
complex changes though, please check up with the core devs first on [our gitter channel](https://gitter.im/ethereum/go-ethereum)
61-
to ensure those changes are in line with the general philosopy of the project and/or get some
65+
to ensure those changes are in line with the general philosophy of the project and/or get some
6266
early feedback which can make both your efforts much lighter as well as our review and merge
6367
procedures quick and simple.
6468

65-
Please make sure your contributions adhere to our coding guidlines:
69+
Please make sure your contributions adhere to our coding guidelines:
6670

6771
* Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)).
68-
* Code must be documented adherign to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines.
72+
* Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines.
6973
* Pull requests need to be based on and opened against the `develop` branch.
7074
* Commit messages should be prefixed with the package(s) they modify.
7175
* E.g. "eth, rpc: make trace configs optional"

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.5
1+
1.4.6

cmd/geth/accountcmd.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/codegangsta/cli"
2424
"github.com/ethereum/go-ethereum/accounts"
2525
"github.com/ethereum/go-ethereum/cmd/utils"
26+
"github.com/ethereum/go-ethereum/console"
2627
"github.com/ethereum/go-ethereum/crypto"
2728
"github.com/ethereum/go-ethereum/logger"
2829
"github.com/ethereum/go-ethereum/logger/glog"
@@ -215,12 +216,12 @@ func getPassPhrase(prompt string, confirmation bool, i int, passwords []string)
215216
if prompt != "" {
216217
fmt.Println(prompt)
217218
}
218-
password, err := utils.Stdin.PasswordPrompt("Passphrase: ")
219+
password, err := console.Stdin.PromptPassword("Passphrase: ")
219220
if err != nil {
220221
utils.Fatalf("Failed to read passphrase: %v", err)
221222
}
222223
if confirmation {
223-
confirm, err := utils.Stdin.PasswordPrompt("Repeat passphrase: ")
224+
confirm, err := console.Stdin.PromptPassword("Repeat passphrase: ")
224225
if err != nil {
225226
utils.Fatalf("Failed to read passphrase confirmation: %v", err)
226227
}

cmd/geth/chaincmd.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/codegangsta/cli"
2727
"github.com/ethereum/go-ethereum/cmd/utils"
2828
"github.com/ethereum/go-ethereum/common"
29+
"github.com/ethereum/go-ethereum/console"
2930
"github.com/ethereum/go-ethereum/core"
3031
"github.com/ethereum/go-ethereum/core/state"
3132
"github.com/ethereum/go-ethereum/core/types"
@@ -116,7 +117,7 @@ func exportChain(ctx *cli.Context) {
116117
}
117118

118119
func removeDB(ctx *cli.Context) {
119-
confirm, err := utils.Stdin.ConfirmPrompt("Remove local database?")
120+
confirm, err := console.Stdin.PromptConfirm("Remove local database?")
120121
if err != nil {
121122
utils.Fatalf("%v", err)
122123
}

cmd/geth/consolecmd.go

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
// Copyright 2016 The go-ethereum Authors
2+
// This file is part of go-ethereum.
3+
//
4+
// go-ethereum is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// go-ethereum is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
16+
17+
package main
18+
19+
import (
20+
"os"
21+
"os/signal"
22+
23+
"github.com/codegangsta/cli"
24+
"github.com/ethereum/go-ethereum/cmd/utils"
25+
"github.com/ethereum/go-ethereum/console"
26+
)
27+
28+
var (
29+
consoleCommand = cli.Command{
30+
Action: localConsole,
31+
Name: "console",
32+
Usage: `Geth Console: interactive JavaScript environment`,
33+
Description: `
34+
The Geth console is an interactive shell for the JavaScript runtime environment
35+
which exposes a node admin interface as well as the Ðapp JavaScript API.
36+
See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console
37+
`,
38+
}
39+
attachCommand = cli.Command{
40+
Action: remoteConsole,
41+
Name: "attach",
42+
Usage: `Geth Console: interactive JavaScript environment (connect to node)`,
43+
Description: `
44+
The Geth console is an interactive shell for the JavaScript runtime environment
45+
which exposes a node admin interface as well as the Ðapp JavaScript API.
46+
See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console.
47+
This command allows to open a console on a running geth node.
48+
`,
49+
}
50+
javascriptCommand = cli.Command{
51+
Action: ephemeralConsole,
52+
Name: "js",
53+
Usage: `executes the given JavaScript files in the Geth JavaScript VM`,
54+
Description: `
55+
The JavaScript VM exposes a node admin interface as well as the Ðapp
56+
JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console
57+
`,
58+
}
59+
)
60+
61+
// localConsole starts a new geth node, attaching a JavaScript console to it at the
62+
// same time.
63+
func localConsole(ctx *cli.Context) {
64+
// Create and start the node based on the CLI flags
65+
node := utils.MakeSystemNode(clientIdentifier, verString, relConfig, makeDefaultExtra(), ctx)
66+
startNode(ctx, node)
67+
defer node.Stop()
68+
69+
// Attach to the newly started node and start the JavaScript console
70+
client, err := node.Attach()
71+
if err != nil {
72+
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
73+
}
74+
config := console.Config{
75+
DataDir: node.DataDir(),
76+
DocRoot: ctx.GlobalString(utils.JSpathFlag.Name),
77+
Client: client,
78+
Preload: utils.MakeConsolePreloads(ctx),
79+
}
80+
console, err := console.New(config)
81+
if err != nil {
82+
utils.Fatalf("Failed to start the JavaScript console: %v", err)
83+
}
84+
defer console.Stop(false)
85+
86+
// If only a short execution was requested, evaluate and return
87+
if script := ctx.GlobalString(utils.ExecFlag.Name); script != "" {
88+
console.Evaluate(script)
89+
return
90+
}
91+
// Otherwise print the welcome screen and enter interactive mode
92+
console.Welcome()
93+
console.Interactive()
94+
}
95+
96+
// remoteConsole will connect to a remote geth instance, attaching a JavaScript
97+
// console to it.
98+
func remoteConsole(ctx *cli.Context) {
99+
// Attach to a remotely running geth instance and start the JavaScript console
100+
client, err := utils.NewRemoteRPCClient(ctx)
101+
if err != nil {
102+
utils.Fatalf("Unable to attach to remote geth: %v", err)
103+
}
104+
config := console.Config{
105+
DataDir: utils.MustMakeDataDir(ctx),
106+
DocRoot: ctx.GlobalString(utils.JSpathFlag.Name),
107+
Client: client,
108+
Preload: utils.MakeConsolePreloads(ctx),
109+
}
110+
console, err := console.New(config)
111+
if err != nil {
112+
utils.Fatalf("Failed to start the JavaScript console: %v", err)
113+
}
114+
defer console.Stop(false)
115+
116+
// If only a short execution was requested, evaluate and return
117+
if script := ctx.GlobalString(utils.ExecFlag.Name); script != "" {
118+
console.Evaluate(script)
119+
return
120+
}
121+
// Otherwise print the welcome screen and enter interactive mode
122+
console.Welcome()
123+
console.Interactive()
124+
}
125+
126+
// ephemeralConsole starts a new geth node, attaches an ephemeral JavaScript
127+
// console to it, and each of the files specified as arguments and tears the
128+
// everything down.
129+
func ephemeralConsole(ctx *cli.Context) {
130+
// Create and start the node based on the CLI flags
131+
node := utils.MakeSystemNode(clientIdentifier, verString, relConfig, makeDefaultExtra(), ctx)
132+
startNode(ctx, node)
133+
defer node.Stop()
134+
135+
// Attach to the newly started node and start the JavaScript console
136+
client, err := node.Attach()
137+
if err != nil {
138+
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
139+
}
140+
config := console.Config{
141+
DataDir: node.DataDir(),
142+
DocRoot: ctx.GlobalString(utils.JSpathFlag.Name),
143+
Client: client,
144+
Preload: utils.MakeConsolePreloads(ctx),
145+
}
146+
console, err := console.New(config)
147+
if err != nil {
148+
utils.Fatalf("Failed to start the JavaScript console: %v", err)
149+
}
150+
defer console.Stop(false)
151+
152+
// Evaluate each of the specified JavaScript files
153+
for _, file := range ctx.Args() {
154+
if err = console.Execute(file); err != nil {
155+
utils.Fatalf("Failed to execute %s: %v", file, err)
156+
}
157+
}
158+
// Wait for pending callbacks, but stop for Ctrl-C.
159+
abort := make(chan os.Signal, 1)
160+
signal.Notify(abort, os.Interrupt)
161+
162+
go func() {
163+
<-abort
164+
os.Exit(0)
165+
}()
166+
console.Stop(true)
167+
}

0 commit comments

Comments
 (0)