[Bitcoin-development] # error "Bitcoin cannot be compiled without assertions." <<<<NOT

Pieter Wuille pieter.wuille at gmail.com
Fri Jun 6 08:40:20 UTC 2014

On Fri, Jun 6, 2014 at 10:29 AM, Wladimir <laanwj at gmail.com> wrote:
> On Wed, Jun 4, 2014 at 12:42 PM, Jannis Froese
> <s9jafroe at stud.uni-saarland.de> wrote:
>> I think most concerns about the current use of asserts would be resolved
>> if the currently used asserts would be changed to a nicer definition which
>> is independent of NDEBUG, and a second class of debugging asserts would be
>> introduced, which is exclusively for expensive, redundant checks and is
>> disabled by NDEBUG.

There are a few examples of things that would classify as
expensive/redundant checks:
* addrman consistency checks (only enabled with -DDEBUG_ADDRMAN).
* mempool consistency checks (only enabled with -checkmempool).
* deadlock detection (only enabled with -DDEBUG_LOCKORDER).

I'm not sure all of these make sense to put under a single runtime
flag. For example, addrman consistency is unlikely to be affected
unless you're working on addrman code, and is pretty expensive.

Still, I do like the idea of optional consistency checks, that help
guarantee the software always has a consistency state.


More information about the bitcoin-dev mailing list