aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
Diffstat (limited to 'accounts')
-rw-r--r--accounts/account_manager.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/accounts/account_manager.go b/accounts/account_manager.go
index 2781be656..74006395c 100644
--- a/accounts/account_manager.go
+++ b/accounts/account_manager.go
@@ -44,6 +44,10 @@ type Account struct {
Address common.Address
}
+func (acc *Account) MarshalJSON() ([]byte, error) {
+ return []byte(`"` + acc.Address.Hex() + `"`), nil
+}
+
type Manager struct {
keyStore crypto.KeyStore
unlocked map[common.Address]*unlocked
@@ -92,6 +96,17 @@ func (am *Manager) Unlock(addr common.Address, keyAuth string) error {
return am.TimedUnlock(addr, keyAuth, 0)
}
+func (am *Manager) Lock(addr common.Address) error {
+ am.mutex.Lock()
+ if unl, found := am.unlocked[addr]; found {
+ am.mutex.Unlock()
+ am.expire(addr, unl, time.Duration(0) * time.Nanosecond)
+ } else {
+ am.mutex.Unlock()
+ }
+ return nil
+}
+
// TimedUnlock unlocks the account with the given address. The account
// stays unlocked for the duration of timeout. A timeout of 0 unlocks the account
// until the program exits.