Skip to content

Commit 1fa48bc

Browse files
author
Bas van Kervel
committed
Introduced default unlock duration when an account is unlocked from the console
1 parent bc83761 commit 1fa48bc

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎accounts/account_manager.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ var (
4949
ErrNoKeys = errors.New("no keys in store")
5050
)
5151

52+
const (
53+
// Default unlock duration (in seconds) when an account is unlocked from the console
54+
DefaultAccountUnlockDuration = 300
55+
)
56+
5257
type Account struct {
5358
Address common.Address
5459
}

‎cmd/geth/admin.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strconv"
99
"time"
1010

11+
"github.com/ethereum/go-ethereum/accounts"
1112
"github.com/ethereum/go-ethereum/cmd/utils"
1213
"github.com/ethereum/go-ethereum/common"
1314
"github.com/ethereum/go-ethereum/common/compiler"
@@ -374,6 +375,10 @@ func (js *jsre) unlock(call otto.FunctionCall) otto.Value {
374375
fmt.Println(err)
375376
return otto.FalseValue()
376377
}
378+
if seconds == 0 {
379+
seconds = accounts.DefaultAccountUnlockDuration
380+
}
381+
377382
arg := call.Argument(1)
378383
var passphrase string
379384
if arg.IsUndefined() {

0 commit comments

Comments
 (0)