The -assumevalid
option skips script verification for a specified block and all its ancestors during Initial Block Download.
Many new users are surprised when this suddenly slows their node to a halt.
This commit adds a log message to clearly indicate when this optimization ends and full validation begins (and vice versa).
The behavior can easily be tested by adding this before the new log:
0 // TODO hack to enable/disable script checks based on block height for testing purposes
1 if (pindex->nHeight < 100) fScriptChecks = false;
2 else if (pindex->nHeight < 200) fScriptChecks = true;
3 else if (pindex->nHeight < 300) fScriptChecks = false;
4 else if (pindex->nHeight < 400) fScriptChecks = true;
and exercise the new code with:
0cmake -B build && cmake --build build && mkdir -p demo && build/bin/bitcoind -datadir=demo -stopatheight=500 | grep 'signature validation'
showing something like:
- Disabling signature validations at block #1 (00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048).
- Enabling signature validations at block #100 (000000007bc154e0fa7ea32218a72fe2c1bb9f86cf8c9ebf9a715ed27fdb229a).
- Disabling signature validations at block #200 (000000008f1a7008320c16b8402b7f11e82951f44ca2663caf6860ab2eeef320).
- Enabling signature validations at block #300 (0000000062b69e4a2c3312a5782d7798b0711e9ebac065cd5d19f946439f8609).