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
8820d970
Commit
8820d970
authored
Jan 11, 2017
by
Felix Lange
Committed by
GitHub
Jan 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal/ethapi: fix duration parameter of personal_unlockAccount (#3542)
parent
b52fde7c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
api.go
internal/ethapi/api.go
+8
-5
No files found.
internal/ethapi/api.go
View file @
8820d970
...
@@ -19,7 +19,9 @@ package ethapi
...
@@ -19,7 +19,9 @@ package ethapi
import
(
import
(
"bytes"
"bytes"
"encoding/hex"
"encoding/hex"
"errors"
"fmt"
"fmt"
"math"
"math/big"
"math/big"
"strings"
"strings"
"time"
"time"
...
@@ -237,17 +239,18 @@ func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string) (commo
...
@@ -237,17 +239,18 @@ func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string) (commo
// UnlockAccount will unlock the account associated with the given address with
// UnlockAccount will unlock the account associated with the given address with
// the given password for duration seconds. If duration is nil it will use a
// the given password for duration seconds. If duration is nil it will use a
// default of 300 seconds. It returns an indication if the account was unlocked.
// default of 300 seconds. It returns an indication if the account was unlocked.
func
(
s
*
PrivateAccountAPI
)
UnlockAccount
(
addr
common
.
Address
,
password
string
,
duration
*
hexutil
.
Uint
)
(
bool
,
error
)
{
func
(
s
*
PrivateAccountAPI
)
UnlockAccount
(
addr
common
.
Address
,
password
string
,
duration
*
uint64
)
(
bool
,
error
)
{
const
max
=
uint64
(
time
.
Duration
(
math
.
MaxInt64
)
/
time
.
Second
)
var
d
time
.
Duration
var
d
time
.
Duration
if
duration
==
nil
{
if
duration
==
nil
{
d
=
300
*
time
.
Second
d
=
300
*
time
.
Second
}
else
if
*
duration
>
max
{
return
false
,
errors
.
New
(
"unlock duration too large"
)
}
else
{
}
else
{
d
=
time
.
Duration
(
*
duration
)
*
time
.
Second
d
=
time
.
Duration
(
*
duration
)
*
time
.
Second
}
}
if
err
:=
s
.
am
.
TimedUnlock
(
accounts
.
Account
{
Address
:
addr
},
password
,
d
);
err
!=
nil
{
err
:=
s
.
am
.
TimedUnlock
(
accounts
.
Account
{
Address
:
addr
},
password
,
d
)
return
false
,
err
return
err
==
nil
,
err
}
return
true
,
nil
}
}
// LockAccount will lock the account associated with the given address when it's unlocked.
// LockAccount will lock the account associated with the given address when it's unlocked.
...
...
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