diff options
author | zelig <viktor.tron@gmail.com> | 2015-03-25 23:45:56 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-03-27 03:00:18 +0800 |
commit | 11d2ebc06ffffa8846d5d55cae5663fac6f685f1 (patch) | |
tree | b8be3aaf5d35bd8a87f0468bd051a16e485a3ae0 /accounts | |
parent | 4ec38e39320ee9abccd96da765a9c65fccd04151 (diff) | |
download | dexon-11d2ebc06ffffa8846d5d55cae5663fac6f685f1.tar.gz dexon-11d2ebc06ffffa8846d5d55cae5663fac6f685f1.tar.zst dexon-11d2ebc06ffffa8846d5d55cae5663fac6f685f1.zip |
unlocking coinbase without knowing address
- accounts: remove Manager.getKey
- cli: for -unlock coinbase, use account manager Coinbase()
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/account_manager.go | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/accounts/account_manager.go b/accounts/account_manager.go index f063f8ca5..392518703 100644 --- a/accounts/account_manager.go +++ b/accounts/account_manager.go @@ -36,9 +36,8 @@ import ( "bytes" "crypto/ecdsa" crand "crypto/rand" - "os" - "errors" + "os" "sync" "time" @@ -101,17 +100,6 @@ func (am *Manager) firstAddr() ([]byte, error) { return addrs[0], nil } -func (am *Manager) getKey(addr []byte, keyAuth string) (*crypto.Key, error) { - if len(addr) == 0 { - var err error - addr, err = am.firstAddr() - if err != nil { - return nil, err - } - } - return am.keyStore.GetKey(addr, keyAuth) -} - func (am *Manager) DeleteAccount(address []byte, auth string) error { return am.keyStore.DeleteKey(address, auth) } @@ -130,7 +118,7 @@ func (am *Manager) Sign(a Account, toSign []byte) (signature []byte, err error) // TimedUnlock unlocks the account with the given address. // When timeout has passed, the account will be locked again. func (am *Manager) TimedUnlock(addr []byte, keyAuth string, timeout time.Duration) error { - key, err := am.getKey(addr, keyAuth) + key, err := am.keyStore.GetKey(addr, keyAuth) if err != nil { return err } @@ -143,7 +131,7 @@ func (am *Manager) TimedUnlock(addr []byte, keyAuth string, timeout time.Duratio // stays unlocked until the program exits or until a TimedUnlock // timeout (started after the call to Unlock) expires. func (am *Manager) Unlock(addr []byte, keyAuth string) error { - key, err := am.getKey(addr, keyAuth) + key, err := am.keyStore.GetKey(addr, keyAuth) if err != nil { return err } |