good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
88d7119e
Unverified
Commit
88d7119e
authored
Apr 2, 2019
by
Péter Szilágyi
Committed by
GitHub
Apr 2, 2019
Browse files
Options
Downloads
Plain Diff
Merge pull request #19374 from karalabe/console-fix-coinbase-printout
console: handle eth.coinbase throws
parents
c4109d79
3baed8dd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
console/console.go
+17
-9
17 additions, 9 deletions
console/console.go
rpc/handler.go
+1
-1
1 addition, 1 deletion
rpc/handler.go
with
18 additions
and
10 deletions
console/console.go
+
17
−
9
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
...
...
This diff is collapsed.
Click to expand it.
rpc/handler.go
+
1
−
1
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
))
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment