diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -330,7 +330,8 @@ * Note that we guarantee that either the proof-of-work is valid on pblock, or * (and possibly also) BlockChecked will have been called. * - * Call without cs_main held. + * May not be called with cs_main held. May not be called in a + * validationinterface callback. * * @param[in] config The global config. * @param[in] pblock The block we want to process. @@ -347,7 +348,8 @@ /** * Process incoming block headers. * - * Call without cs_main held. + * May not be called with cs_main held. May not be called in a + * validationinterface callback. * * @param[in] config The config. * @param[in] block The block headers themselves. @@ -422,6 +424,9 @@ /** * Find the best known block, and make it the tip of the block chain + * + * May not be called with cs_main held. May not be called in a + * validationinterface callback. */ bool ActivateBestChain( const Config &config, CValidationState &state, @@ -632,7 +637,12 @@ CBlockIndex *FindForkInGlobalIndex(const CChain &chain, const CBlockLocator &locator); -/** Mark a block as precious and reorganize. */ +/** + * Mark a block as precious and reorganize. + * + * May not be called with cs_main held. May not be called in a + * validationinterface callback. + */ bool PreciousBlock(const Config &config, CValidationState &state, CBlockIndex *pindex); diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2907,6 +2907,9 @@ // Block until the validation queue drains. This should largely // never happen in normal operation, however may happen during // reindex, causing memory blowup if we run too far ahead. + // Note that if a validationinterface callback ends up calling + // ActivateBestChain this may lead to a deadlock! We should + // probably have a DEBUG_LOCKORDER test for this in the future. SyncWithValidationInterfaceQueue(); }