diff --git a/accounts/account_manager.go b/accounts/account_manager.go index 6cbd23c4e92ceda4e68120c681a55e5dc1e0c2e7..13f16296a81048114664ebf4a4fa442bcb433937 100644 --- a/accounts/account_manager.go +++ b/accounts/account_manager.go @@ -49,6 +49,11 @@ var ( 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 { Address common.Address } diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go index 15923c3663992009ff7a8bd405944686995596ea..91a336cbbe4a0302f2bf4d0d571791d6828fd4fc 100644 --- a/cmd/geth/admin.go +++ b/cmd/geth/admin.go @@ -8,6 +8,7 @@ import ( "strconv" "time" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/compiler" @@ -374,6 +375,10 @@ func (js *jsre) unlock(call otto.FunctionCall) otto.Value { fmt.Println(err) return otto.FalseValue() } + if seconds == 0 { + seconds = accounts.DefaultAccountUnlockDuration + } + arg := call.Argument(1) var passphrase string if arg.IsUndefined() {