Update db.cpp

Incorporate locks exhaustion fix per https://github.com/CryptoManiac/novacoin/commit/16e1262471dba899f3e9251b485abec219aec844
Update addrman.h

Resolve sqrt in addrman.cpp
Merge pull request #2 from joebauers/master

Bitcoin->Novacoin locks exhaustion fix