Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
88d7119e
Unverified
Commit
88d7119e
authored
Apr 02, 2019
by
Péter Szilágyi
Committed by
GitHub
Apr 02, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19374 from karalabe/console-fix-coinbase-printout
console: handle eth.coinbase throws
parents
c4109d79
3baed8dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
console.go
console/console.go
+17
-9
handler.go
rpc/handler.go
+1
-1
No files found.
console/console.go
View file @
88d7119e
...
@@ -274,14 +274,22 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str
...
@@ -274,14 +274,22 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str
// Welcome show summary of current Geth instance and some metadata about the
// Welcome show summary of current Geth instance and some metadata about the
// console's available modules.
// console's available modules.
func
(
c
*
Console
)
Welcome
()
{
func
(
c
*
Console
)
Welcome
()
{
message
:=
"Welcome to the Geth JavaScript console!
\n\n
"
// Print some generic Geth metadata
// Print some generic Geth metadata
fmt
.
Fprintf
(
c
.
printer
,
"Welcome to the Geth JavaScript console!
\n\n
"
)
if
res
,
err
:=
c
.
jsre
.
Run
(
`
c
.
jsre
.
Run
(
`
var message = "instance: " + web3.version.node + "\n";
console.log("instance: " + web3.version.node);
try {
console.log("coinbase: " + eth.coinbase);
message += "coinbase: " + eth.coinbase + "\n";
console.log("at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")");
} catch (err) {}
console.log(" datadir: " + admin.datadir);
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
// List all the supported modules for the user to call
if
apis
,
err
:=
c
.
client
.
SupportedModules
();
err
==
nil
{
if
apis
,
err
:=
c
.
client
.
SupportedModules
();
err
==
nil
{
modules
:=
make
([]
string
,
0
,
len
(
apis
))
modules
:=
make
([]
string
,
0
,
len
(
apis
))
...
@@ -289,9 +297,9 @@ func (c *Console) Welcome() {
...
@@ -289,9 +297,9 @@ func (c *Console) Welcome() {
modules
=
append
(
modules
,
fmt
.
Sprintf
(
"%s:%s"
,
api
,
version
))
modules
=
append
(
modules
,
fmt
.
Sprintf
(
"%s:%s"
,
api
,
version
))
}
}
sort
.
Strings
(
modules
)
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
// Evaluate executes code and pretty prints the result to the specified output
...
...
rpc/handler.go
View file @
88d7119e
...
@@ -297,7 +297,7 @@ func (h *handler) handleCallMsg(ctx *callProc, msg *jsonrpcMessage) *jsonrpcMess
...
@@ -297,7 +297,7 @@ func (h *handler) handleCallMsg(ctx *callProc, msg *jsonrpcMessage) *jsonrpcMess
case
msg
.
isCall
()
:
case
msg
.
isCall
()
:
resp
:=
h
.
handleCall
(
ctx
,
msg
)
resp
:=
h
.
handleCall
(
ctx
,
msg
)
if
resp
.
Error
!=
nil
{
if
resp
.
Error
!=
nil
{
h
.
log
.
Info
(
"Served "
+
msg
.
Method
,
"reqid"
,
idForLog
{
msg
.
ID
},
"t"
,
time
.
Since
(
start
),
"err"
,
resp
.
Error
.
Message
)
h
.
log
.
Warn
(
"Served "
+
msg
.
Method
,
"reqid"
,
idForLog
{
msg
.
ID
},
"t"
,
time
.
Since
(
start
),
"err"
,
resp
.
Error
.
Message
)
}
else
{
}
else
{
h
.
log
.
Debug
(
"Served "
+
msg
.
Method
,
"reqid"
,
idForLog
{
msg
.
ID
},
"t"
,
time
.
Since
(
start
))
h
.
log
.
Debug
(
"Served "
+
msg
.
Method
,
"reqid"
,
idForLog
{
msg
.
ID
},
"t"
,
time
.
Since
(
start
))
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment