Merge pull request #2748 from lbryio/cached-wallet-id

faster wallet.id attribute, improves speed of selecting wallets during api calls
This commit is contained in:
Jack Robison 2020-01-27 13:58:23 -05:00 committed by GitHub
commit 8961848ab1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,12 +74,10 @@ class Wallet:
self.storage = storage or WalletStorage() self.storage = storage or WalletStorage()
self.preferences = TimestampedPreferences(preferences or {}) self.preferences = TimestampedPreferences(preferences or {})
self.encryption_password = None self.encryption_password = None
self.id = self.get_id()
@property def get_id(self):
def id(self): return os.path.basename(self.storage.path) if self.storage.path else self.name
if self.storage.path:
return os.path.basename(self.storage.path)
return self.name
def add_account(self, account: 'Account'): def add_account(self, account: 'Account'):
self.accounts.append(account) self.accounts.append(account)