diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-08-01 23:45:17 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-08-09 16:30:17 +0800 |
commit | db568a61e2a98880ab308bf2224aa34073dc7f39 (patch) | |
tree | 97da46661ad3002b6ff9f6dca07e3105da5a9c5a /accounts/keystore | |
parent | 17ce0a37de5a2712a8bf9d58df705e718b3b2cd6 (diff) | |
download | go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.gz go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.bz2 go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.lz go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.xz go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.zst go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.zip |
accounts, console, internal: support trezor hardware wallet
Diffstat (limited to 'accounts/keystore')
-rw-r--r-- | accounts/keystore/keystore.go | 6 | ||||
-rw-r--r-- | accounts/keystore/keystore_test.go | 8 |
2 files changed, 7 insertions, 7 deletions
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) |