def load_wallet(self, wallet): self.wallet = wallet if not self.is_available(): return mpk = self.wallet.get_master_public_keys() self.cosigner_list = [] for key, xpub in mpk.items(): keyname = key + '/' # fixme K = bitcoin.deserialize_xkey(xpub)[-1].encode('hex') _hash = bitcoin.Hash(K).encode('hex') if self.wallet.master_private_keys.get(keyname): self.listener.set_key(keyname, _hash) else: self.cosigner_list.append((xpub, K, _hash))
def load_wallet(self, wallet): self.wallet = wallet if not self.is_available(): return if self.listener is None: self.listener = Listener(self) self.listener.start() self.cosigner_list = [] for key, xpub in self.wallet.master_public_keys.items(): K = bitcoin.deserialize_xkey(xpub)[-1].encode('hex') _hash = bitcoin.Hash(K).encode('hex') if self.wallet.master_private_keys.get(key): self.listener.set_key(key, _hash) else: self.cosigner_list.append((xpub, K, _hash))
def update(self, window): wallet = window.wallet if wallet.wallet_type not in ['2of2', '2of3']: return if self.listener is None: self.print_error("starting listener") self.listener = Listener(self) self.listener.start() elif self.listener: self.print_error("shutting down listener") self.listener.stop() self.listener = None self.keys = [] self.cosigner_list = [] for key, xpub in wallet.master_public_keys.items(): K = bitcoin.deserialize_xkey(xpub)[-1].encode('hex') _hash = bitcoin.Hash(K).encode('hex') if wallet.master_private_keys.get(key): self.keys.append((key, _hash, window)) else: self.cosigner_list.append((window, xpub, K, _hash)) if self.listener: self.listener.set_keyhashes([t[1] for t in self.keys])
def update(self, window): wallet = window.wallet if type(wallet) != Multisig_Wallet: return if self.listener is None: self.print_error("starting listener") self.listener = Listener(self) self.listener.start() elif self.listener: self.print_error("shutting down listener") self.listener.stop() self.listener = None self.keys = [] self.cosigner_list = [] for key, keystore in wallet.keystores.items(): xpub = keystore.get_master_public_key() K = bitcoin.deserialize_xpub(xpub)[-1] _hash = bh2u(bitcoin.Hash(K)) if not keystore.is_watching_only(): self.keys.append((key, _hash, window)) else: self.cosigner_list.append((window, xpub, K, _hash)) if self.listener: self.listener.set_keyhashes([t[1] for t in self.keys])