txdb and coindb refactoring