diff --git a/electrum b/electrum index e7f86f8d2..010e6bcfc 100755 --- a/electrum +++ b/electrum @@ -79,7 +79,7 @@ if is_bundle or is_local or is_android: from electrum import util from electrum import SimpleConfig, Network, Wallet, WalletStorage from electrum.util import print_msg, print_error, print_stderr, json_encode, json_decode, set_verbosity, InvalidPassword -from electrum.plugins import Plugins, run_hook, always_hook +from electrum.plugins import Plugins, run_hook from electrum.commands import get_parser, known_commands, Commands, config_variables from electrum.daemon import Daemon, get_daemon @@ -242,8 +242,6 @@ def run_offline_command(config, config_options): sys.exit(1) if cmd.requires_network: print_stderr("Warning: running command offline") - # notify plugins - always_hook('cmdline_load_wallet', wallet) # arguments passed to function args = map(lambda x: config.get(x), cmd.params) # decode json arguments diff --git a/lib/plugins.py b/lib/plugins.py index 8fc84d114..959dd48c1 100644 --- a/lib/plugins.py +++ b/lib/plugins.py @@ -145,16 +145,10 @@ def hook(func): return func def run_hook(name, *args): - return _run_hook(name, False, *args) - -def always_hook(name, *args): - return _run_hook(name, True, *args) - -def _run_hook(name, always, *args): results = [] f_list = hooks.get(name, []) for p, f in f_list: - if always or p.is_enabled(): + if p.is_enabled(): try: r = f(*args) except Exception: diff --git a/plugins/ledger/cmdline.py b/plugins/ledger/cmdline.py index 274699421..cb9f12f0c 100644 --- a/plugins/ledger/cmdline.py +++ b/plugins/ledger/cmdline.py @@ -1,6 +1,5 @@ from legder import LedgerPlugin from electrum.util import print_msg -from electrum.plugins import hook class BTChipCmdLineHandler: def stop(self): @@ -18,8 +17,4 @@ class BTChipCmdLineHandler: return response class Plugin(LedgerPlugin): - @hook - def cmdline_load_wallet(self, wallet): - wallet.plugin = self - if self.handler is None: - self.handler = BTChipCmdLineHandler() + handler = BTChipCmdLineHandler()