This is an alternative to #11694.
It reintroduces a uint256 variable with the best block hash, protected by csBestBlock, and only updated while holding it.
Also rename the involved variable to modern guidelines, as there are very few uses.
Concept ACK! Much better than PR #11694 which I'm now closing :-)
utACK 42be289.
162 | @@ -163,8 +163,9 @@ extern BlockMap& mapBlockIndex; 163 | extern uint64_t nLastBlockTx; 164 | extern uint64_t nLastBlockWeight; 165 | extern const std::string strMessageMagic; 166 | -extern CWaitableCriticalSection csBestBlock; 167 | -extern CConditionVariable cvBlockChange; 168 | +extern CWaitableCriticalSection cs_best_block; 169 | +extern CConditionVariable cv_best_block_change; 170 | +extern uint256 best_block_hash;
Maybe prefix global variable name with g_. (I would probably call these g_best_block g_best_block_mutex g_best_block_cv.)
Fixed.
utACK 42be289df0c277777f7bbfc383ca7520140775cf. Nice simple bugfix.
utACK d1cbc67a.
utACK, although would prefer the renaming was in a separate commit.
utACK 4a6c0e3dcfdca98270cb96b73db4c3d4446dba50. Only change since last review renaming variables and splitting commit.
utACK 4a6c0e3dcfdca98270cb96b73db4c3d4446dba50
Travis timeout. Kicking.