From 8a7983604446b3ad4a95c9d175e354339370b606 Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Mon, 20 Nov 2017 12:20:46 +0200 Subject: accounts: list, then subscribe (sub requires active reader) --- accounts/manager.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'accounts/manager.go') diff --git a/accounts/manager.go b/accounts/manager.go index 78ddb1368..96ca298fc 100644 --- a/accounts/manager.go +++ b/accounts/manager.go @@ -41,6 +41,11 @@ type Manager struct { // NewManager creates a generic account manager to sign transaction via various // supported backends. func NewManager(backends ...Backend) *Manager { + // Retrieve the initial list of wallets from the backends and sort by URL + var wallets []Wallet + for _, backend := range backends { + wallets = merge(wallets, backend.Wallets()...) + } // Subscribe to wallet notifications from all backends updates := make(chan WalletEvent, 4*len(backends)) @@ -48,11 +53,6 @@ func NewManager(backends ...Backend) *Manager { for i, backend := range backends { subs[i] = backend.Subscribe(updates) } - // Retrieve the initial list of wallets from the backends and sort by URL - var wallets []Wallet - for _, backend := range backends { - wallets = merge(wallets, backend.Wallets()...) - } // Assemble the account manager and return am := &Manager{ backends: make(map[reflect.Type][]Backend), -- cgit