missing-identity performance improvement.

Handling missing-identity messages was using an expensive sql query.
This has been replaced with two simple queries resulting in a
considerable performance improvement (all exising indexes can now be
properly used by sqlite).
New unittest and some cleanup.
Merge pull request #114 from boudewijn-tribler/performance

missing-identity performance improvement.