Say there's a server and a client. Normally to connect and establish an end-to-end encrypted session, they'd have to carry out key exchange, which potentially gives an attacker the opportunity to perform an MITM attack.
Say that the client has the server's public key fingerprint or public key hard coded. (Which is better?) Upon connection, the server sends over its public key and the client compares the fingerprints. If they match, the client then sends over its public key and a secure session is established.
Is this a better solution than a key exchange? Are there any potential drawbacks? Will it work? Is there a better way?