Commit 1fa48bc5 authored by Bas van Kervel's avatar Bas van Kervel

Introduced default unlock duration when an account is unlocked from the console

parent bc837619
...@@ -49,6 +49,11 @@ var ( ...@@ -49,6 +49,11 @@ var (
ErrNoKeys = errors.New("no keys in store") ErrNoKeys = errors.New("no keys in store")
) )
const (
// Default unlock duration (in seconds) when an account is unlocked from the console
DefaultAccountUnlockDuration = 300
)
type Account struct { type Account struct {
Address common.Address Address common.Address
} }
......
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/compiler" "github.com/ethereum/go-ethereum/common/compiler"
...@@ -374,6 +375,10 @@ func (js *jsre) unlock(call otto.FunctionCall) otto.Value { ...@@ -374,6 +375,10 @@ func (js *jsre) unlock(call otto.FunctionCall) otto.Value {
fmt.Println(err) fmt.Println(err)
return otto.FalseValue() return otto.FalseValue()
} }
if seconds == 0 {
seconds = accounts.DefaultAccountUnlockDuration
}
arg := call.Argument(1) arg := call.Argument(1)
var passphrase string var passphrase string
if arg.IsUndefined() { if arg.IsUndefined() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment