good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Erigon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
a
Erigon
Commits
470c003d
Commit
470c003d
authored
4 years ago
by
Martin Holst Swende
Committed by
Igor Mandrigin
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
console: fix some crashes/errors in the bridge (#21050)
Fixes #21046
parent
322f4f31
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
console/bridge.go
+10
-1
10 additions, 1 deletion
console/bridge.go
with
10 additions
and
1 deletion
console/bridge.go
+
10
−
1
View file @
470c003d
...
...
@@ -232,6 +232,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"
)
...
...
@@ -275,6 +278,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
)
...
...
@@ -310,6 +316,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>)"
)
}
...
...
@@ -337,7 +346,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
()
...
...
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