OpenBazaar/OpenBazaar — pull request #779 by yagoulas (2014-10-11 23:23:50+00:00)
Title: Do not try to encrypt unless the public key of the recipient is present

* Sometimes it happens that we try to send a message without setting CryptoPeerConnection.pub. This is obviously wrong. To make matters worse we return False in this case in CryptoPeerConnection.ecrypt while the caller checks for a None return value. As a result in this case we end up sending a False value to the other peer instead of aborting the send.
* Fix it by adding an assertion that makes sure that we always assign the public key before trying to send. An assertion should be used as the whole reason CryptoPeerConnection exists is that it encrypts and sends messages, so trying to send without a public key is an obvious programming error (or an obvious omission).