Allow specifying dbtx in TxnBegin.

Optionally allow specifying an existing DbTxn to use in TxnBegin of the
DBs, so that one can use an atomic transaction across multiple databases
to fix syncing issues in the future.
Update support for reusing DbTxn's across DBs.

Implement better support for reusing database transactions to
synchronise multiple DBs with TxnBegin(parent-txn).  Keep track of which
transactions are our own, and only abort/commit those.
Fix handling of return value in TxnCommit/TxnAbort.

In the changes introduced to TxnCommit/TxnAbort due to ownTxn, the
return value was ignored so far due to an oversight.  Correct this.
Allow specifying dbtx in TxnBegin.

Optionally allow specifying an existing DbTxn to use in TxnBegin of the
DBs, so that one can use an atomic transaction across multiple databases
to fix syncing issues in the future.
Move CNameDB to db.h.

Move the CNameDB class to db.h and move the definition of vchType to
headers.  Fix the includes in other files so that everything compiles.
Add DatabaseSet wrapper class and use it.

Introduce a new class DatabaseSet that wraps around the "blockchain
status databases" CTxDB and CNameDB.  Use it instead of the classes
themselves for blockchain validation.  The only net effect this has is
that CNameDB is not created/destroyed in each Connect/DisconnectInputs
hook, but at the same time as the CTxDB.  It possibly also fixes syncing
between both with atomic transactions.
Properly create nameindex database when it not exists.

Ensure that the nameindex database is created before loading the block
index when it does not yet exist, otherwise using DatabaseSet fails.
Merge pull request #86 from domob1812/db-updater

Combine handling of txdb and namedb
Make CTxIndex::vSpent private.

Make the CTxIndex::vSpent member private, and access it only via
interface functions from the outside.
Change internal vSpent data format.

Actually change the vSpent array internally to be an array of flags
instead of full tx positions.  Not yet efficiently as a bit vector,
though.
Switch isSpent to std::vector<bool> and bit vector.

Use std::vector<bool> for the flag array, and implement proper
serialisation routines for bit vectors.
Allow setting of stream version in the DB.

Allow setting of the nVersion parameter used for stream serialisation in
the database.
Fully rewrite txindex on upgrading blkindex.dat format.

When upgrading the blkindex.dat data format, actually fully rewrite the
txindex objects stored in it.
Add comment and close DB earlier.
Rename variable to clarify its intent.
Remove serialisation versino from CDiskBlockIndex storage.

Don't store the nVersion field for CDiskBlockIndex, since we now have
the DB serialisation version.  (The nVersion of the block header is not
affected.)
Fix setting of stream versions for LoadBlockIndex.
Add assertion check for fRead | version up to date.
Remove unused skip field and don't overwrite version in CDB::Rewrite.

In CDB::Rewrite, just do a literal rewrite.  Don't skip fields and don't
overwrite the version.