Defensive api code for issue #350

Defensive code in the unlikely event we have two messages with the same msg when calling getInboxMessageById and getSentMessageById as documented in issue bitmessage/PyBitmessage#350