Add AssertLockHeld for cs_main to ChainActive-using functions
All functions that use ChainActive but do not aquire the cs_main lock themselves, need to be called with the cs_main lock held. This commit adds assertions to all externally callable functions that use chainActive or chainMostWork. This will flag usages when built with -DDEBUG_LOCKORDER.
This commit is contained in:
@@ -150,6 +150,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
|
||||
|
||||
void TransactionRecord::updateStatus(const CWalletTx &wtx)
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
// Determine transaction status
|
||||
|
||||
// Find the block the tx is in
|
||||
@@ -234,6 +235,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
|
||||
|
||||
bool TransactionRecord::statusUpdateNeeded()
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
return status.cur_num_blocks != chainActive.Height();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user