Hi
@evoskuil, I have a small question about how asserts are used and how that interacts with NDEBUG flag enabled by default in the makefiles.
Consider the update_confirmation_state method in bitcoin_database.
https://github.com/libbitcoin/libbitcoin-database/blob/a0f64d2f904ec1e53e1b5b93eb8ede4102a8198f/src/databases/block_database.cpp#L361
If asserts are disabled, say NDEBUG is enabled, which is default in the libbitcoin Makefiles, then asserts will not get triggered. Even if an invariant fails, a block’s state will get updated.
This could result in a not yet validated block being marked as confirmed, if data_base incorrectly calls the index method with such args. In fact, I was doing so in my first rewrites of the block database tests.
I might be missing a detail somewhere. But I wanted to ask if it will make sense to convert the asserts to a simple condition and a return in case of the invariants failing. Or, do we expect production builds to disable NDEBUG? I have now set up my environment to always use --disable-ndebug so I can catch any similar bad situations from my code.