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
bd60295d
Unverified
Commit
bd60295d
authored
May 11, 2020
by
Martin Holst Swende
Committed by
GitHub
May 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
console: fix some crashes/errors in the bridge (#21050)
Fixes #21046
parent
930e82d7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
bridge.go
console/bridge.go
+10
-1
No files found.
console/bridge.go
View file @
bd60295d
...
...
@@ -229,6 +229,9 @@ func (b *bridge) readPinAndReopenWallet(call jsre.Call) (goja.Value, error) {
// original RPC method (saved in jeth.unlockAccount) with it to actually execute
// the RPC call.
func
(
b
*
bridge
)
UnlockAccount
(
call
jsre
.
Call
)
(
goja
.
Value
,
error
)
{
if
nArgs
:=
len
(
call
.
Arguments
);
nArgs
<
2
{
return
nil
,
fmt
.
Errorf
(
"usage: unlockAccount(account, [ password, duration ])"
)
}
// Make sure we have an account specified to unlock.
if
call
.
Argument
(
0
)
.
ExportType
()
.
Kind
()
!=
reflect
.
String
{
return
nil
,
fmt
.
Errorf
(
"first argument must be the account to unlock"
)
...
...
@@ -272,6 +275,9 @@ func (b *bridge) UnlockAccount(call jsre.Call) (goja.Value, error) {
// prompt to acquire the passphrase and executes the original RPC method (saved in
// jeth.sign) with it to actually execute the RPC call.
func
(
b
*
bridge
)
Sign
(
call
jsre
.
Call
)
(
goja
.
Value
,
error
)
{
if
nArgs
:=
len
(
call
.
Arguments
);
nArgs
<
2
{
return
nil
,
fmt
.
Errorf
(
"usage: sign(message, account, [ password ])"
)
}
var
(
message
=
call
.
Argument
(
0
)
account
=
call
.
Argument
(
1
)
...
...
@@ -307,6 +313,9 @@ func (b *bridge) Sign(call jsre.Call) (goja.Value, error) {
// Sleep will block the console for the specified number of seconds.
func
(
b
*
bridge
)
Sleep
(
call
jsre
.
Call
)
(
goja
.
Value
,
error
)
{
if
nArgs
:=
len
(
call
.
Arguments
);
nArgs
<
1
{
return
nil
,
fmt
.
Errorf
(
"usage: sleep(<number of seconds>)"
)
}
if
!
isNumber
(
call
.
Argument
(
0
))
{
return
nil
,
fmt
.
Errorf
(
"usage: sleep(<number of seconds>)"
)
}
...
...
@@ -334,7 +343,7 @@ func (b *bridge) SleepBlocks(call jsre.Call) (goja.Value, error) {
blocks
=
call
.
Argument
(
0
)
.
ToInteger
()
}
if
nArgs
>=
2
{
if
isNumber
(
call
.
Argument
(
1
))
{
if
!
isNumber
(
call
.
Argument
(
1
))
{
return
nil
,
fmt
.
Errorf
(
"expected number as second argument"
)
}
sleep
=
call
.
Argument
(
1
)
.
ToInteger
()
...
...
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