def on_receive(self): if self.wallet.use_encryption: password = self.win.password_dialog( 'An encrypted transaction was retrieved from cosigning pool.\nPlease enter your password to decrypt it.' ) if not password: return else: password = None if not self.win.question( _("An encrypted transaction was retrieved from cosigning pool.\nDo you want to open it now?" )): return message = self.listener.message key = self.listener.keyname xprv = self.wallet.get_master_private_key(key, password) if not xprv: return try: k = bitcoin.deserialize_xkey(xprv)[-1].encode('hex') EC = bitcoin.EC_KEY(k.decode('hex')) message = EC.decrypt_message(message) except Exception as e: traceback.print_exc(file=sys.stdout) self.win.show_message(str(e)) return self.listener.clear() tx = transaction.Transaction(message) d = transaction_dialog.TxDialog(tx, self.win) d.saved = False d.exec_()
def on_receive(self): if self.wallet.use_encryption: password = self.win.password_dialog('An encrypted transaction was retrieved from cosigning pool.\nPlease enter your password to decrypt it.') if not password: return else: password = None if not self.win.question(_("An encrypted transaction was retrieved from cosigning pool.\nDo you want to open it now?")): return message = self.listener.message key = self.listener.keyname xprv = self.wallet.get_master_private_key(key, password) if not xprv: return try: k = bitcoin.deserialize_xkey(xprv)[-1].encode('hex') EC = bitcoin.EC_KEY(k.decode('hex')) message = EC.decrypt_message(message) except Exception as e: traceback.print_exc(file=sys.stdout) self.win.show_message(str(e)) return self.listener.clear() tx = transaction.Transaction(message) d = transaction_dialog.TxDialog(tx, self.win) d.saved = False d.exec_()
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))