Limit maximum DB locks needed for blocks in a softfork.

This introduces an explicitly specified limit for the number of DB locks
that can be used for a new block.  This limit matches the rebased client
exactly, so that we don't run into the issue that Bitcoin faced in March
2013.  See also
https://github.com/bitcoin/bitcoin/commit/8c222dca4f961ad13ec64d690134a40d09b20813
and the corresponding commit to Namecore.