def on_enabled_changed(self): if cosigner_pool.is_enabled(): if self.listener is None: logger.debug("starting listener") self.listener = Listener(self) self.listener.start() for window in app_state.app.windows: self.window_opened(window) elif self.listener: logger.debug("shutting down listener") self.listener.stop() self.listener = None self.items.clear()
def window_opened(self, window): wallet = window.wallet if cosigner_pool.is_enabled() and type(wallet) == Multisig_Wallet: items = [] for key, keystore in wallet.keystores.items(): xpub = keystore.get_master_public_key() K = deserialize_xpub(xpub)[-1] K_hash = bh2u(sha256d(K)) items.append( CosignerItem(window, xpub, K, K_hash, keystore.is_watching_only())) # Presumably atomic self.items.extend(items)
def window_opened(self, window: 'ElectrumWindow'): wallet = window.parent_wallet.get_default_wallet() if cosigner_pool.is_enabled() and type(wallet) is Multisig_Wallet: items = [] for keystore in wallet.get_keystores(): xpub = keystore.get_master_public_key() pubkey = bip32_key_from_string(xpub) K = pubkey.to_bytes() K_hash = bh2u(sha256d(K)) items.append( CosignerItem(window, xpub, K, K_hash, keystore.is_watching_only())) # Presumably atomic self.items.extend(items)
def _window_opened(self, window: 'ElectrumWindow') -> None: if not cosigner_pool.is_enabled(): return for account in window._wallet.get_accounts(): if type(account) is not MultisigAccount: continue account_id = account.get_id() items = [] for keystore in account.get_keystores(): xpub = keystore.get_master_public_key() pubkey = bip32_key_from_string(xpub) pubkey_bytes = pubkey.to_bytes() keyhash_hex = sha256d(pubkey_bytes).hex() items.append(CosignerItem(window, account_id, xpub, pubkey_bytes, keyhash_hex, keystore.is_watching_only())) self._items.extend(items)
def window_closed(self, window): if cosigner_pool.is_enabled(): self.items = [item for item in self.items if item.window != window]
def _window_closed(self, window: 'ElectrumWindow') -> None: if cosigner_pool.is_enabled(): self._items = [ item for item in self._items if item.window != window ]