浏览代码

Merge pull request #973 from bas-vk/issue972

Introduced default unlock duration when an account is unlocked from t…
Jeffrey Wilcke 10 年之前
父节点
当前提交
ff87c241a7
共有 2 个文件被更改,包括 10 次插入0 次删除
  1. 5 0
      accounts/account_manager.go
  2. 5 0
      cmd/geth/admin.go

+ 5 - 0
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
 }

+ 5 - 0
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() {