Fix coins db upgrade check.
Fix coins db upgrade check.

There is a function in the code to check for old (actually ancient)
versions of the coins db, and warning about needing a reindex for them.
This check is supposed to see if there are any of the obsolete DB_COINS
keys in the UTXO database, but the logic is incomplete (it just seeks and
checks if the iterator is valid, but not if it actually seeked to such
a key and not e.g. beyond to the next entry).

For some reason that is working on Bitcoin and used to work on Namecoin
as well until recently, but now it breaks when names are in the database
(yielding false positives).

This commit makes the check more explicit, which can not be a bad idea
in general, and fixes the issues.

namecoin/namecore,namecoin/namecore,namecoin/namecoin-core,namecoin/namecoin-core,namecoin/namecore,namecoin/namecoin-core,namecoin/namecoin-core,namecoin/namecore,namecoin/namecore,namecoin/namecoin-core,namecoin/namecore,namecoin/namecoin-core