@@ -170,7 +170,7 @@ class CChainState {
170
170
// Block (dis)connection on a given view:
171
171
DisconnectResult DisconnectBlock (const CBlock& block, const CBlockIndex* pindex, CCoinsViewCache& view);
172
172
bool ConnectBlock (const CBlock& block, CValidationState& state, CBlockIndex* pindex,
173
- CCoinsViewCache& view, const CChainParams& chainparams, bool fJustCheck = false );
173
+ CCoinsViewCache& view, const CChainParams& chainparams, bool fJustCheck = false ) EXCLUSIVE_LOCKS_REQUIRED(cs_main );
174
174
175
175
// Block disconnection on our pcoinsTip:
176
176
bool DisconnectTip (CValidationState& state, const CChainParams& chainparams, DisconnectedBlockTransactions *disconnectpool);
@@ -189,8 +189,8 @@ class CChainState {
189
189
void UnloadBlockIndex ();
190
190
191
191
private:
192
- bool ActivateBestChainStep (CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexMostWork, const std::shared_ptr<const CBlock>& pblock, bool & fInvalidFound , ConnectTrace& connectTrace);
193
- bool ConnectTip (CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const std::shared_ptr<const CBlock>& pblock, ConnectTrace& connectTrace, DisconnectedBlockTransactions &disconnectpool);
192
+ bool ActivateBestChainStep (CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexMostWork, const std::shared_ptr<const CBlock>& pblock, bool & fInvalidFound , ConnectTrace& connectTrace) EXCLUSIVE_LOCKS_REQUIRED(cs_main) ;
193
+ bool ConnectTip (CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const std::shared_ptr<const CBlock>& pblock, ConnectTrace& connectTrace, DisconnectedBlockTransactions &disconnectpool) EXCLUSIVE_LOCKS_REQUIRED(cs_main) ;
194
194
195
195
CBlockIndex* AddToBlockIndex (const CBlockHeader& block) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
196
196
/* * Create a new block index entry for a given block hash */
@@ -202,7 +202,7 @@ class CChainState {
202
202
*/
203
203
void CheckBlockIndex (const Consensus::Params& consensusParams);
204
204
205
- void InvalidBlockFound (CBlockIndex *pindex, const CValidationState &state);
205
+ void InvalidBlockFound (CBlockIndex *pindex, const CValidationState &state) EXCLUSIVE_LOCKS_REQUIRED(cs_main) ;
206
206
CBlockIndex* FindMostWorkChain () EXCLUSIVE_LOCKS_REQUIRED(cs_main);
207
207
void ReceivedBlockTransactions (const CBlock& block, CBlockIndex* pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
208
208
@@ -457,7 +457,7 @@ std::string FormatStateMessage(const CValidationState &state)
457
457
state.GetRejectCode ());
458
458
}
459
459
460
- static bool IsCurrentForFeeEstimation ()
460
+ static bool IsCurrentForFeeEstimation () EXCLUSIVE_LOCKS_REQUIRED(cs_main)
461
461
{
462
462
AssertLockHeld (cs_main);
463
463
if (IsInitialBlockDownload ())
@@ -482,7 +482,7 @@ static bool IsCurrentForFeeEstimation()
482
482
* and instead just erase from the mempool as needed.
483
483
*/
484
484
485
- static void UpdateMempoolForReorg (DisconnectedBlockTransactions &disconnectpool, bool fAddToMempool )
485
+ static void UpdateMempoolForReorg (DisconnectedBlockTransactions &disconnectpool, bool fAddToMempool ) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
486
486
{
487
487
AssertLockHeld (cs_main);
488
488
std::vector<uint256> vHashUpdate;
@@ -524,7 +524,7 @@ static void UpdateMempoolForReorg(DisconnectedBlockTransactions &disconnectpool,
524
524
// Used to avoid mempool polluting consensus critical paths if CCoinsViewMempool
525
525
// were somehow broken and returning the wrong scriptPubKeys
526
526
static bool CheckInputsFromMempoolAndCache (const CTransaction& tx, CValidationState& state, const CCoinsViewCache& view, const CTxMemPool& pool,
527
- unsigned int flags, bool cacheSigStore, PrecomputedTransactionData& txdata) {
527
+ unsigned int flags, bool cacheSigStore, PrecomputedTransactionData& txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
528
528
AssertLockHeld (cs_main);
529
529
530
530
// pool.cs should be locked already, but go ahead and re-take the lock here
@@ -559,7 +559,7 @@ static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, CValidationSt
559
559
560
560
static bool AcceptToMemoryPoolWorker (const CChainParams& chainparams, CTxMemPool& pool, CValidationState& state, const CTransactionRef& ptx,
561
561
bool * pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
562
- bool bypass_limits, const CAmount& nAbsurdFee, std::vector<COutPoint>& coins_to_uncache, bool test_accept)
562
+ bool bypass_limits, const CAmount& nAbsurdFee, std::vector<COutPoint>& coins_to_uncache, bool test_accept) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
563
563
{
564
564
const CTransaction& tx = *ptx;
565
565
const uint256 hash = tx.GetHash ();
@@ -977,7 +977,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
977
977
/* * (try to) add transaction to memory pool with a specified acceptance time **/
978
978
static bool AcceptToMemoryPoolWithTime (const CChainParams& chainparams, CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx,
979
979
bool * pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
980
- bool bypass_limits, const CAmount nAbsurdFee, bool test_accept)
980
+ bool bypass_limits, const CAmount nAbsurdFee, bool test_accept) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
981
981
{
982
982
std::vector<COutPoint> coins_to_uncache;
983
983
bool res = AcceptToMemoryPoolWorker (chainparams, pool, state, tx, pfMissingInputs, nAcceptTime, plTxnReplaced, bypass_limits, nAbsurdFee, coins_to_uncache, test_accept);
@@ -1216,7 +1216,7 @@ static void AlertNotify(const std::string& strMessage)
1216
1216
t.detach (); // thread runs free
1217
1217
}
1218
1218
1219
- static void CheckForkWarningConditions ()
1219
+ static void CheckForkWarningConditions () EXCLUSIVE_LOCKS_REQUIRED(cs_main)
1220
1220
{
1221
1221
AssertLockHeld (cs_main);
1222
1222
// Before we get past initial download, we cannot reliably alert about forks
@@ -1257,7 +1257,7 @@ static void CheckForkWarningConditions()
1257
1257
}
1258
1258
}
1259
1259
1260
- static void CheckForkWarningConditionsOnNewFork (CBlockIndex* pindexNewForkTip)
1260
+ static void CheckForkWarningConditionsOnNewFork (CBlockIndex* pindexNewForkTip) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
1261
1261
{
1262
1262
AssertLockHeld (cs_main);
1263
1263
// If we are on a fork that is sufficiently large, set a warning flag
@@ -1290,7 +1290,7 @@ static void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip)
1290
1290
CheckForkWarningConditions ();
1291
1291
}
1292
1292
1293
- void static InvalidChainFound (CBlockIndex* pindexNew)
1293
+ void static InvalidChainFound (CBlockIndex* pindexNew) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
1294
1294
{
1295
1295
if (!pindexBestInvalid || pindexNew->nChainWork > pindexBestInvalid->nChainWork )
1296
1296
pindexBestInvalid = pindexNew;
@@ -1377,7 +1377,7 @@ void InitScriptExecutionCache() {
1377
1377
*
1378
1378
* Non-static (and re-declared) in src/test/txvalidationcache_tests.cpp
1379
1379
*/
1380
- bool CheckInputs (const CTransaction& tx, CValidationState &state, const CCoinsViewCache &inputs, bool fScriptChecks , unsigned int flags, bool cacheSigStore, bool cacheFullScriptStore, PrecomputedTransactionData& txdata, std::vector<CScriptCheck> *pvChecks)
1380
+ bool CheckInputs (const CTransaction& tx, CValidationState &state, const CCoinsViewCache &inputs, bool fScriptChecks , unsigned int flags, bool cacheSigStore, bool cacheFullScriptStore, PrecomputedTransactionData& txdata, std::vector<CScriptCheck> *pvChecks) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
1381
1381
{
1382
1382
if (!tx.IsCoinBase ())
1383
1383
{
@@ -1743,7 +1743,7 @@ static bool IsScriptWitnessEnabled(const Consensus::Params& params)
1743
1743
return params.vDeployments [Consensus::DEPLOYMENT_SEGWIT].nTimeout != 0 ;
1744
1744
}
1745
1745
1746
- static unsigned int GetBlockScriptFlags (const CBlockIndex* pindex, const Consensus::Params& consensusparams) {
1746
+ static unsigned int GetBlockScriptFlags (const CBlockIndex* pindex, const Consensus::Params& consensusparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
1747
1747
AssertLockHeld (cs_main);
1748
1748
1749
1749
unsigned int flags = SCRIPT_VERIFY_NONE;
@@ -2863,6 +2863,7 @@ bool CChainState::InvalidateBlock(CValidationState& state, const CChainParams& c
2863
2863
}
2864
2864
return true ;
2865
2865
}
2866
+
2866
2867
bool InvalidateBlock (CValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex) {
2867
2868
return g_chainstate.InvalidateBlock (state, chainparams, pindex);
2868
2869
}
0 commit comments