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) xprv_chain = bitcoin.bip32_private_derivation(xprv, "", "/{}".format(self.wallet.active_chain.chain_index))[0] if not xprv_chain: return try: k = bitcoin.deserialize_xkey(xprv_chain)[-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.deserialize(message) self.win.show_transaction(tx)
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) xprv_chain = bitcoin.bip32_private_derivation( xprv, "", "/{}".format(self.wallet.active_chain.chain_index))[0] if not xprv_chain: return try: k = bitcoin.deserialize_xkey(xprv_chain)[-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.deserialize(message) self.win.show_transaction(tx)
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(): xpub_chain = bitcoin.bip32_public_derivation(xpub, "", "/{}".format(self.wallet.active_chain.chain_index)) K = bitcoin.deserialize_xkey(xpub_chain)[-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_chain, K, _hash))