aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-08 08:52:49 +0800
committerFelix Lange <fjl@twurst.com>2015-03-08 08:58:35 +0800
commitfb53a9362e1238d8edb466d77427dc3cbb13eb20 (patch)
tree8ed3fbda85d4a62fe8225190493b14014e7b947f /accounts
parent3750ec7b7de04d8482b798e73f04637ea9e1ca89 (diff)
downloadgo-tangerine-fb53a9362e1238d8edb466d77427dc3cbb13eb20.tar.gz
go-tangerine-fb53a9362e1238d8edb466d77427dc3cbb13eb20.tar.zst
go-tangerine-fb53a9362e1238d8edb466d77427dc3cbb13eb20.zip
accounts: AccountManager -> Manager
Diffstat (limited to 'accounts')
-rw-r--r--accounts/account_manager.go26
-rw-r--r--accounts/accounts_test.go4
2 files changed, 15 insertions, 15 deletions
diff --git a/accounts/account_manager.go b/accounts/account_manager.go
index bb6d970b2..97cf7c878 100644
--- a/accounts/account_manager.go
+++ b/accounts/account_manager.go
@@ -52,7 +52,7 @@ type Account struct {
Address []byte
}
-type AccountManager struct {
+type Manager struct {
keyStore crypto.KeyStore2
unlocked map[string]*unlocked
unlockTime time.Duration
@@ -66,8 +66,8 @@ type unlocked struct {
*crypto.Key
}
-func NewAccountManager(keyStore crypto.KeyStore2, unlockTime time.Duration) *AccountManager {
- return &AccountManager{
+func NewManager(keyStore crypto.KeyStore2, unlockTime time.Duration) *Manager {
+ return &Manager{
keyStore: keyStore,
unlocked: make(map[string]*unlocked),
unlockTime: unlockTime,
@@ -75,19 +75,19 @@ func NewAccountManager(keyStore crypto.KeyStore2, unlockTime time.Duration) *Acc
}
// Coinbase returns the account address that mining rewards are sent to.
-func (am *AccountManager) Coinbase() (addr []byte, err error) {
+func (am *Manager) Coinbase() (addr []byte, err error) {
// TODO: persist coinbase address on disk
return am.firstAddr()
}
// MainAccount returns the primary account used for transactions.
-func (am *AccountManager) Default() (Account, error) {
+func (am *Manager) Default() (Account, error) {
// TODO: persist main account address on disk
addr, err := am.firstAddr()
return Account{Address: addr}, err
}
-func (am *AccountManager) firstAddr() ([]byte, error) {
+func (am *Manager) firstAddr() ([]byte, error) {
addrs, err := am.keyStore.GetKeyAddresses()
if err != nil {
return nil, err
@@ -98,11 +98,11 @@ func (am *AccountManager) firstAddr() ([]byte, error) {
return addrs[0], nil
}
-func (am *AccountManager) DeleteAccount(address []byte, auth string) error {
+func (am *Manager) DeleteAccount(address []byte, auth string) error {
return am.keyStore.DeleteKey(address, auth)
}
-func (am *AccountManager) Sign(a Account, toSign []byte) (signature []byte, err error) {
+func (am *Manager) Sign(a Account, toSign []byte) (signature []byte, err error) {
am.mutex.RLock()
unlockedKey, found := am.unlocked[string(a.Address)]
am.mutex.RUnlock()
@@ -113,7 +113,7 @@ func (am *AccountManager) Sign(a Account, toSign []byte) (signature []byte, err
return signature, err
}
-func (am *AccountManager) SignLocked(a Account, keyAuth string, toSign []byte) (signature []byte, err error) {
+func (am *Manager) SignLocked(a Account, keyAuth string, toSign []byte) (signature []byte, err error) {
key, err := am.keyStore.GetKey(a.Address, keyAuth)
if err != nil {
return nil, err
@@ -124,7 +124,7 @@ func (am *AccountManager) SignLocked(a Account, keyAuth string, toSign []byte) (
return signature, err
}
-func (am *AccountManager) NewAccount(auth string) (Account, error) {
+func (am *Manager) NewAccount(auth string) (Account, error) {
key, err := am.keyStore.GenerateNewKey(crand.Reader, auth)
if err != nil {
return Account{}, err
@@ -132,7 +132,7 @@ func (am *AccountManager) NewAccount(auth string) (Account, error) {
return Account{Address: key.Address}, nil
}
-func (am *AccountManager) Accounts() ([]Account, error) {
+func (am *Manager) Accounts() ([]Account, error) {
addresses, err := am.keyStore.GetKeyAddresses()
if err != nil {
return nil, err
@@ -148,7 +148,7 @@ func (am *AccountManager) Accounts() ([]Account, error) {
return accounts, err
}
-func (am *AccountManager) addUnlocked(addr []byte, key *crypto.Key) *unlocked {
+func (am *Manager) addUnlocked(addr []byte, key *crypto.Key) *unlocked {
u := &unlocked{addr: addr, abort: make(chan struct{}), Key: key}
am.mutex.Lock()
prev, found := am.unlocked[string(addr)]
@@ -162,7 +162,7 @@ func (am *AccountManager) addUnlocked(addr []byte, key *crypto.Key) *unlocked {
return u
}
-func (am *AccountManager) dropLater(u *unlocked) {
+func (am *Manager) dropLater(u *unlocked) {
t := time.NewTimer(am.unlockTime)
defer t.Stop()
select {
diff --git a/accounts/accounts_test.go b/accounts/accounts_test.go
index 30e0b011a..b90da2892 100644
--- a/accounts/accounts_test.go
+++ b/accounts/accounts_test.go
@@ -12,7 +12,7 @@ import (
func TestAccountManager(t *testing.T) {
ks := crypto.NewKeyStorePlain(ethutil.DefaultDataDir() + "/testaccounts")
- am := NewAccountManager(ks, 100*time.Millisecond)
+ am := NewManager(ks, 100*time.Millisecond)
pass := "" // not used but required by API
a1, err := am.NewAccount(pass)
toSign := randentropy.GetEntropyCSPRNG(32)
@@ -38,7 +38,7 @@ func TestAccountManager(t *testing.T) {
func TestAccountManagerLocking(t *testing.T) {
ks := crypto.NewKeyStorePassphrase(ethutil.DefaultDataDir() + "/testaccounts")
- am := NewAccountManager(ks, 200*time.Millisecond)
+ am := NewManager(ks, 200*time.Millisecond)
pass := "foo"
a1, err := am.NewAccount(pass)
toSign := randentropy.GetEntropyCSPRNG(32)
:59 +0800'>2008-10-0418-104/+714 * Tasks progress. Merge EMemoPreview back into ECalComponentPreview.Matthew Barnes2008-10-0321-928/+963 * Update the headers on files I've created or completely rewritten to matchMatthew Barnes2008-10-0233-363/+396 * Merge revisions 36016:36533 from trunk.Matthew Barnes2008-10-0259-732/+1038 * Add more EShell API documentation.Matthew Barnes2008-10-023-3/+9 * More Memos debugging.Matthew Barnes2008-10-016-48/+171 * Memos are mostly working now. Tasks to follow.Matthew Barnes2008-09-3010-26/+378 * Get Memos to come up. Doesn't really work yet, but the widgets are all there.Matthew Barnes2008-09-3047-2296/+2602 * Tasks and memos progress. Hoping to merge ECalendarTable and EMemoTable,Matthew Barnes2008-09-2612-912/+964 * Saving progress. Experimenting with directory layout.Matthew Barnes2008-09-2560-2060/+3276 * Replace EActivityHandler with a new activity-tracking system that usesMatthew Barnes2008-09-203-5/+2 * Progress update:Matthew Barnes2008-09-182-23/+0 * Massive address book refactoring. Things are mostly working again.Matthew Barnes2008-09-172-0/+12 * Forgot to commit a couple files.Matthew Barnes2008-09-132-0/+356 * Allow EShellContent, EShellSidebar, and EShellTaskbar to be subclassed,Matthew Barnes2008-09-1328-1202/+1272 * Arrange for an ESourceList to be shared amongst all instances of a type ofMatthew Barnes2008-09-1223-460/+780 * Merge revisions 36016:36303 from trunk.Matthew Barnes2008-09-11165-2183/+2794 * Add popup menu stubs for calendars, tasks and memos.Matthew Barnes2008-09-118-293/+156 * Add menu and toolbar UI for calendars, memos and tasks.Matthew Barnes2008-09-1124-219/+1210 * Add stubs for calendar, task, and memo shell views.Matthew Barnes2008-09-1118-0/+1161 * Progress update:Matthew Barnes2008-09-091-1/+2 * Saving progress. Lots of changes. Things are a bit broken at the moment.Matthew Barnes2008-09-051-6/+6 * ** Fixes bug #549968Matthew Barnes2008-08-312-1/+8 * ** Fixes bug #549967Matthew Barnes2008-08-313-4/+12 * Merge revisions 35993:36015 from trunk.Matthew Barnes2008-08-195-2/+36 * Merge revisions 35951:35992 from trunk.Matthew Barnes2008-08-1543-374/+545 * Merge revisions 35931:35950 from trunk.Matthew Barnes2008-08-132-3/+10 * Merge revisions 35747:35930 from trunk.Matthew Barnes2008-08-0819-90/+509 * Migrate CompEditor, CompEditorPage, and the various subclasses fromMatthew Barnes2008-07-1635-4896/+4115 * ** Fix for bug #542889Paolo Borelli2008-07-143-5/+9 * Patch from Paul Bolle <pebolle@tiscali.nl>: Fix for bug #542101 (Escape Plac...Suman Manjunath2008-07-132-1/+8 * Patch from Keith Packard <keithp@keithp.com>: Fix for bug #541355 (Remove fr...Suman Manjunath2008-07-134-0/+18 * ** Fix for bug #524130Milan Crha2008-07-093-32/+21 * ** Fix for bug #368038Milan Crha2008-07-042-1/+22 * ** Fix for bug #540152Milan Crha2008-07-034-5/+13 * Patch from Maciej Piechotka <uzytkownik2@gmail.com>Tobias Mueller2008-06-284-166/+173 * updated novell copyright notices (left others alone)Jeffrey Stedfast2008-06-21220-269/+269 * Use <glib/gi18n.h> instead of <bonobo/bonobo-i18n.h>.Matthew Barnes2008-06-119-8/+20 * ** Fix for bug #536813Milan Crha2008-06-095-3/+44 * Fix build breakage. Apparently <gtk/gtk.h> only recently startedMatthew Barnes2008-06-072-0/+2 * ** Allow evolution to build with G_DISABLE_SINGLE_INCLUDES andMatthew Barnes2008-06-0695-299/+84 * ** Fixes security vulnerabilities CVE-2008-1108 and CVE-2008-1109Matthew Barnes2008-06-043-96/+96 * ** Fix for bug #535204Shuai Liu2008-06-042-2/+8 * Committing on behalf of Milan Crha <mcrha@redhat.com>Milan Crha2008-06-024-1/+42 * ** Fixes bug #534476Matthew Barnes2008-05-232-9/+12 * Patch from Milan Crha <mcrha@redhat.com> ** Part of fix for bug #523402 (lea...Suman Manjunath2008-05-233-0/+12 * ** Fix a bunch of compiler warnings.Matthew Barnes2008-05-232-9/+6 * ** Fixes bug #534360Matthew Barnes2008-05-2374-663/+813 * Patch from Chenthill Palanisamy <pchenthill@novell.com> ** Fix for bug #5338...Suman Manjunath2008-05-222-2/+16 * Include e-util-private.h for the mapping of EVOLUTION_GLADEDIR to aTor Lillqvist2008-05-082-2/+17 * Fix include path for e-dbhash.h, now in libebackend.Johan Euphrosine2008-05-052-1/+5 * ** Fix for bug #316390Milan Crha2008-04-304-66/+27 * Patch from Srinivasa Ragavan <sragavan@novell.com>Bharath Acharya2008-04-302-0/+12 * Patch from Ashish Shrivastava <shashish@novell.com>Ashish Shrivastava2008-04-302-1/+11 * ** Fix for bug #240823Milan Crha2008-04-292-2/+16 * ** Fix for bug #524121Milan Crha2008-04-282-1/+8 * ** Fix for bug #529893Danny Baumann2008-04-252-0/+8 * ** Fix for bug #509923Milan Crha2008-04-184-7/+80 * Remove and obsolete comment from configure.in and #include <gio/gio.h> inMatthew Barnes2008-04-181-0/+1 * ** Fix for bug #526741 (gnome-vfs to gio/gvfs port)Milan Crha2008-04-1813-145/+186 * ** Fix for bug #523402Milan Crha2008-04-172-0/+9 * ** Fix for bug #232594Milan Crha2008-04-162-13/+29 * Fix for bug #517134 : Extend the 'Insert' menu (in editors) to show a "Recent...Suman Manjunath2008-04-122-15/+65 * ** Fix for bug #525234Ondrej Jirman2008-04-07