Skip to content

Commit fc01745

Browse files
Merge pull request ethereum#2 from ethereum/master
Latest changes from go-ethereum
2 parents 8b9e77d + fe070ab commit fc01745

File tree

44 files changed

+714
-156
lines changed

Some content is hidden

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

44 files changed

+714
-156
lines changed

accounts/abi/bind/bind.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func Bind(types []string, abis []string, bytecodes []string, pkg string, lang La
129129
return string(code), nil
130130
}
131131
// For all others just return as is for now
132-
return string(buffer.Bytes()), nil
132+
return buffer.String(), nil
133133
}
134134

135135
// bindType is a set of type binders that convert Solidity types to some supported

accounts/abi/unpack_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,11 @@ func TestUnmarshal(t *testing.T) {
368368
if err != nil {
369369
t.Error(err)
370370
} else {
371-
if bytes.Compare(p0, p0Exp) != 0 {
371+
if !bytes.Equal(p0, p0Exp) {
372372
t.Errorf("unexpected value unpacked: want %x, got %x", p0Exp, p0)
373373
}
374374

375-
if bytes.Compare(p1[:], p1Exp) != 0 {
375+
if !bytes.Equal(p1[:], p1Exp) {
376376
t.Errorf("unexpected value unpacked: want %x, got %x", p1Exp, p1)
377377
}
378378
}

accounts/keystore/presale.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ func decryptPreSaleKey(fileContent []byte, password string) (key *Key, err error
5858
if err != nil {
5959
return nil, errors.New("invalid hex in encSeed")
6060
}
61+
if len(encSeedBytes) < 16 {
62+
return nil, errors.New("invalid encSeed, too short")
63+
}
6164
iv := encSeedBytes[:16]
6265
cipherText := encSeedBytes[16:]
6366
/*

bmt/bmt.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,7 @@ func NewTree(hasher BaseHasher, segmentSize, segmentCount int) *Tree {
260260
for d := 1; d <= depth(segmentCount); d++ {
261261
nodes := make([]*Node, count)
262262
for i := 0; i < len(nodes); i++ {
263-
var parent *Node
264-
parent = prevlevel[i/2]
263+
parent := prevlevel[i/2]
265264
t := NewNode(level, i, parent)
266265
nodes[i] = t
267266
}

build/ci.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ func doLint(cmdline []string) {
319319
packages = flag.CommandLine.Args()
320320
}
321321
// Get metalinter and install all supported linters
322-
build.MustRun(goTool("get", "gopkg.in/alecthomas/gometalinter.v1"))
323-
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), "--install")
322+
build.MustRun(goTool("get", "gopkg.in/alecthomas/gometalinter.v2"))
323+
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v2"), "--install")
324324

325325
// Run fast linters batched together
326326
configs := []string{
@@ -332,12 +332,12 @@ func doLint(cmdline []string) {
332332
"--enable=goconst",
333333
"--min-occurrences=6", // for goconst
334334
}
335-
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), append(configs, packages...)...)
335+
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v2"), append(configs, packages...)...)
336336

337337
// Run slow linters one by one
338338
for _, linter := range []string{"unconvert", "gosimple"} {
339339
configs = []string{"--vendor", "--deadline=10m", "--disable-all", "--enable=" + linter}
340-
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), append(configs, packages...)...)
340+
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v2"), append(configs, packages...)...)
341341
}
342342
}
343343

cmd/faucet/faucet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ func (f *faucet) apiHandler(conn *websocket.Conn) {
506506

507507
// Send an error if too frequent funding, othewise a success
508508
if !fund {
509-
if err = sendError(conn, fmt.Errorf("%s left until next allowance", common.PrettyDuration(timeout.Sub(time.Now())))); err != nil {
509+
if err = sendError(conn, fmt.Errorf("%s left until next allowance", common.PrettyDuration(timeout.Sub(time.Now())))); err != nil { // nolint: gosimple
510510
log.Warn("Failed to send funding error to client", "err", err)
511511
return
512512
}

cmd/geth/consolecmd.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,12 @@ func remoteConsole(ctx *cli.Context) error {
120120
if ctx.GlobalIsSet(utils.DataDirFlag.Name) {
121121
path = ctx.GlobalString(utils.DataDirFlag.Name)
122122
}
123-
if path != "" && ctx.GlobalBool(utils.TestnetFlag.Name) {
124-
path = filepath.Join(path, "testnet")
123+
if path != "" {
124+
if ctx.GlobalBool(utils.TestnetFlag.Name) {
125+
path = filepath.Join(path, "testnet")
126+
} else if ctx.GlobalBool(utils.RinkebyFlag.Name) {
127+
path = filepath.Join(path, "rinkeby")
128+
}
125129
}
126130
endpoint = fmt.Sprintf("%s/geth.ipc", path)
127131
}

cmd/puppeth/module_dashboard.go

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

cmd/swarm/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func envVarsOverride(currentConfig *bzzapi.Config) (config *bzzapi.Config) {
267267
}
268268

269269
//EnsApi can be set to "", so can't check for empty string, as it is allowed
270-
if ensapi, exists := os.LookupEnv(SWARM_ENV_ENS_API); exists == true {
270+
if ensapi, exists := os.LookupEnv(SWARM_ENV_ENS_API); exists {
271271
currentConfig.EnsApi = ensapi
272272
}
273273

cmd/swarm/config_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func TestCmdLineOverrides(t *testing.T) {
124124
t.Fatalf("Expected network ID to be %d, got %d", 42, info.NetworkId)
125125
}
126126

127-
if info.SyncEnabled != true {
127+
if !info.SyncEnabled {
128128
t.Fatal("Expected Sync to be enabled, but is false")
129129
}
130130

@@ -219,7 +219,7 @@ func TestFileOverrides(t *testing.T) {
219219
t.Fatalf("Expected network ID to be %d, got %d", 54, info.NetworkId)
220220
}
221221

222-
if info.SyncEnabled != true {
222+
if !info.SyncEnabled {
223223
t.Fatal("Expected Sync to be enabled, but is false")
224224
}
225225

@@ -334,7 +334,7 @@ func TestEnvVars(t *testing.T) {
334334
t.Fatalf("Expected Cors flag to be set to %s, got %s", "*", info.Cors)
335335
}
336336

337-
if info.SyncEnabled != true {
337+
if !info.SyncEnabled {
338338
t.Fatal("Expected Sync to be enabled, but is false")
339339
}
340340

@@ -431,7 +431,7 @@ func TestCmdLineOverridesFile(t *testing.T) {
431431
t.Fatalf("Expected network ID to be %d, got %d", expectNetworkId, info.NetworkId)
432432
}
433433

434-
if info.SyncEnabled != true {
434+
if !info.SyncEnabled {
435435
t.Fatal("Expected Sync to be enabled, but is false")
436436
}
437437

0 commit comments

Comments
 (0)