def on_receive(self, keyhash, message):
    self.print_error('signal arrived for', keyhash)
    for (key, _hash, window) in self.keys:
        if (_hash == keyhash):
            break
    else:
        self.print_error('keyhash not found')
        return
    wallet = window.wallet
    if wallet.has_keystore_encryption():
        password = window.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 window.question(_('An encrypted transaction was retrieved from cosigning pool.\nDo you want to open it now?'))):
            return
    xprv = wallet.keystore.get_master_private_key(password)
    if (not xprv):
        return
    try:
        k = bh2u(bitcoin.deserialize_xprv(xprv)[(- 1)])
        EC = bitcoin.EC_KEY(bfh(k))
        message = bh2u(EC.decrypt_message(message))
    except Exception as e:
        traceback.print_exc(file=sys.stdout)
        window.show_message(str(e))
        return
    self.listener.clear(keyhash)
    tx = transaction.Transaction(message)
    show_transaction(tx, window, prompt_if_unsaved=True)
def on_receive(self, keyhash, message):
    self.print_error('signal arrived for', keyhash)
    for (key, _hash, window) in self.keys:
        if (_hash == keyhash):
            break
    else:
        self.print_error('keyhash not found')
        return
    wallet = window.wallet
    if wallet.has_keystore_encryption():
        password = window.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 window.question(_('An encrypted transaction was retrieved from cosigning pool.\nDo you want to open it now?'))):
            return
    xprv = wallet.keystore.get_master_private_key(password)
    if (not xprv):
        return
    try:
        k = bh2u(bitcoin.deserialize_xprv(xprv)[(- 1)])
        EC = bitcoin.EC_KEY(bfh(k))
        message = bh2u(EC.decrypt_message(message))
    except Exception as e:
        traceback.print_exc(file=sys.stdout)
        window.show_message(str(e))
        return
    self.listener.clear(keyhash)
    tx = transaction.Transaction(message)
    show_transaction(tx, window, prompt_if_unsaved=True)