diff --git a/console/console.go b/console/console.go index 071f26ab24..3ffdab414a 100644 --- a/console/console.go +++ b/console/console.go @@ -290,14 +290,22 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str // Welcome show summary of current Geth instance and some metadata about the // console's available modules. func (c *Console) Welcome() { + message := "Welcome to the XDC JavaScript console!\n\n" + // Print some generic XDC metadata - fmt.Fprintf(c.printer, "Welcome to the XDC JavaScript console!\n\n") - c.jsre.Run(` - console.log("instance: " + web3.version.node); - console.log("coinbase: " + eth.coinbase); - console.log("at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")"); - console.log(" datadir: " + admin.datadir); - `) + if res, err := c.jsre.Run(` + var message = "instance: " + web3.version.node + "\n"; + try { + message += "coinbase: " + eth.coinbase + "\n"; + } catch (err) {} + message += "at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")\n"; + try { + message += " datadir: " + admin.datadir + "\n"; + } catch (err) {} + message + `); err == nil { + message += res.String() + } // List all the supported modules for the user to call if apis, err := c.client.SupportedModules(); err == nil { modules := make([]string, 0, len(apis)) @@ -305,9 +313,9 @@ func (c *Console) Welcome() { modules = append(modules, fmt.Sprintf("%s:%s", api, version)) } sort.Strings(modules) - fmt.Fprintln(c.printer, " modules:", strings.Join(modules, " ")) + message += " modules: " + strings.Join(modules, " ") + "\n" } - fmt.Fprintln(c.printer) + fmt.Fprintln(c.printer, message) } // Evaluate executes code and pretty prints the result to the specified output diff --git a/rpc/endpoints.go b/rpc/endpoints.go index 0b543102fc..1f5770a45d 100644 --- a/rpc/endpoints.go +++ b/rpc/endpoints.go @@ -36,7 +36,6 @@ func StartIPCEndpoint(ipcEndpoint string, apis []API) (net.Listener, *Server, er log.Info("IPC registration failed", "namespace", api.Namespace, "error", err) return nil, nil, err } - log.Debug("IPC registered", "namespace", api.Namespace) if _, ok := regMap[api.Namespace]; !ok { registered = append(registered, api.Namespace) regMap[api.Namespace] = struct{}{} diff --git a/rpc/ipc_windows.go b/rpc/ipc_windows.go index ca56a3ce43..adb1826f0c 100644 --- a/rpc/ipc_windows.go +++ b/rpc/ipc_windows.go @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . +//go:build windows // +build windows package rpc diff --git a/rpc/subscription_test.go b/rpc/subscription_test.go index 81975ca75c..63f0e0279b 100644 --- a/rpc/subscription_test.go +++ b/rpc/subscription_test.go @@ -25,7 +25,9 @@ import ( "time" ) -func TestNewID2(t *testing.T) { +func TestNewID(t *testing.T) { + t.Parallel() + hexchars := "0123456789ABCDEFabcdef" for i := 0; i < 100; i++ { id := string(NewID()) diff --git a/rpc/utils_test.go b/rpc/utils_test.go deleted file mode 100644 index e0e063f607..0000000000 --- a/rpc/utils_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package rpc - -import ( - "strings" - "testing" -) - -func TestNewID(t *testing.T) { - hexchars := "0123456789ABCDEFabcdef" - for i := 0; i < 100; i++ { - id := string(NewID()) - if !strings.HasPrefix(id, "0x") { - t.Fatalf("invalid ID prefix, want '0x...', got %s", id) - } - - id = id[2:] - if len(id) == 0 || len(id) > 32 { - t.Fatalf("invalid ID length, want len(id) > 0 && len(id) <= 32), got %d", len(id)) - } - - for i := 0; i < len(id); i++ { - if strings.IndexByte(hexchars, id[i]) == -1 { - t.Fatalf("unexpected byte, want any valid hex char, got %c", id[i]) - } - } - } -}