namecoin/namecoin — pull request #86 by domob1812 (2014-05-22 07:25:23+00:00)
Title: Combine handling of txdb and namedb

This patch creates a wrapper class around CTxDB and CNameDB, which are the databases needed for transaction processing. This cleans things up a bit and makes it easier in the future to add more databases, for instance to keep track of the UTXO set.

The only "material" change it makes is that previously, the required CNameDB object was constructed & closed when processing each name transaction in a block. The CTxDB object is constructed only once and a single transaction performed with it, on the other hand. With the patch, both databases are opened and closed only once for processing a series of transactions.

This is the way it should be, IMO. It probably helps with performance (I've no measured data, though) and it helps prevent data inconsistencies between both databases since every update is done to both in a single, atomic BDB transaction. (Snailbrain mentioned to me once that Mikhail thought about this issue, too.)