From db568a61e2a98880ab308bf2224aa34073dc7f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 1 Aug 2017 17:45:17 +0200 Subject: accounts, console, internal: support trezor hardware wallet --- accounts/keystore/keystore.go | 6 +++--- accounts/keystore/keystore_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'accounts/keystore') diff --git a/accounts/keystore/keystore.go b/accounts/keystore/keystore.go index 9df7f2dd9..80ccd3741 100644 --- a/accounts/keystore/keystore.go +++ b/accounts/keystore/keystore.go @@ -143,14 +143,14 @@ func (ks *KeyStore) refreshWallets() { for _, account := range accs { // Drop wallets while they were in front of the next account for len(ks.wallets) > 0 && ks.wallets[0].URL().Cmp(account.URL) < 0 { - events = append(events, accounts.WalletEvent{Wallet: ks.wallets[0], Arrive: false}) + events = append(events, accounts.WalletEvent{Wallet: ks.wallets[0], Kind: accounts.WalletDropped}) ks.wallets = ks.wallets[1:] } // If there are no more wallets or the account is before the next, wrap new wallet if len(ks.wallets) == 0 || ks.wallets[0].URL().Cmp(account.URL) > 0 { wallet := &keystoreWallet{account: account, keystore: ks} - events = append(events, accounts.WalletEvent{Wallet: wallet, Arrive: true}) + events = append(events, accounts.WalletEvent{Wallet: wallet, Kind: accounts.WalletArrived}) wallets = append(wallets, wallet) continue } @@ -163,7 +163,7 @@ func (ks *KeyStore) refreshWallets() { } // Drop any leftover wallets and set the new batch for _, wallet := range ks.wallets { - events = append(events, accounts.WalletEvent{Wallet: wallet, Arrive: false}) + events = append(events, accounts.WalletEvent{Wallet: wallet, Kind: accounts.WalletDropped}) } ks.wallets = wallets ks.mu.Unlock() diff --git a/accounts/keystore/keystore_test.go b/accounts/keystore/keystore_test.go index 5d89a4dbb..132b74439 100644 --- a/accounts/keystore/keystore_test.go +++ b/accounts/keystore/keystore_test.go @@ -296,8 +296,8 @@ func TestWalletNotifications(t *testing.T) { } select { case event := <-updates: - if !event.Arrive { - t.Errorf("departure event on account creation") + if event.Kind != accounts.WalletArrived { + t.Errorf("non-arrival event on account creation") } if event.Wallet.Accounts()[0] != account { t.Errorf("account mismatch on created wallet: have %v, want %v", event.Wallet.Accounts()[0], account) @@ -319,8 +319,8 @@ func TestWalletNotifications(t *testing.T) { } select { case event := <-updates: - if event.Arrive { - t.Errorf("arrival event on account deletion") + if event.Kind != accounts.WalletDropped { + t.Errorf("non-drop event on account deletion") } if event.Wallet.Accounts()[0] != account { t.Errorf("account mismatch on deleted wallet: have %v, want %v", event.Wallet.Accounts()[0], account) -- cgit v1.2.3