electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 56497c1ae202f38b0a3ecad9a4aaacd73a721ad7
parent 1f3ddad0cd687ac6216c26f257190ffa3471c5aa
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Tue, 29 Dec 2015 22:46:22 +0900

Don't use is_available() for HW wallets

is_available() is only used from generic code for non-hardware
wallets.  Having a local function of the same name is confusing.

Diffstat:
Mplugins/ledger/ledger.py | 17++++-------------
Mplugins/trezor/plugin.py | 15++++++---------
2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/plugins/ledger/ledger.py b/plugins/ledger/ledger.py @@ -421,31 +421,22 @@ class LedgerPlugin(BasePlugin): def __init__(self, parent, config, name): BasePlugin.__init__(self, parent, config, name) - self._is_available = self._init() self.wallet = None self.handler = None def constructor(self, s): return BTChipWallet(s) - def _init(self): - return BTCHIP + def set_enabled(self, enabled): + self.wallet.storage.put('use_' + self.name, enabled) - def is_available(self): - if not self._is_available: + def is_enabled(self): + if not BTCHIP: return False if not self.wallet: return False if self.wallet.storage.get('wallet_type') != 'btchip': return False - return True - - def set_enabled(self, enabled): - self.wallet.storage.put('use_' + self.name, enabled) - - def is_enabled(self): - if not self.is_available(): - return False if self.wallet.has_seed(): return False return True diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py @@ -165,19 +165,16 @@ class TrezorCompatiblePlugin(BasePlugin): self.print_error(message) raise Exception(message) - def is_available(self): - if not self.libraries_available: - return False - if not self.wallet: - return False - wallet_type = self.wallet.storage.get('wallet_type') - return wallet_type == self.wallet_class.wallet_type - def set_enabled(self, enabled): self.wallet.storage.put('use_' + self.name, enabled) def is_enabled(self): - if not self.is_available(): + if not self.libraries_available: + return False + if not self.wallet: + return False + wallet_type = self.wallet_class.wallet_type + if self.wallet.storage.get('wallet_type') != wallet_type: return False if self.wallet.has_seed(): return False