From e07c943ce8df6c6cb3ece3fc676911ddb43ca184 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 15 Apr 2014 12:43:17 +0200 Subject: 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. --- src/qt/transactiondesc.cpp | 1 + src/qt/transactionrecord.cpp | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src/qt') diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 4aebaa1e7f..6391f9bc19 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -20,6 +20,7 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx) { + AssertLockHeld(cs_main); if (!IsFinalTx(wtx, chainActive.Height() + 1)) { if (wtx.nLockTime < LOCKTIME_THRESHOLD) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 703a2b4e79..5a3728f498 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -150,6 +150,7 @@ QList 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(); } -- cgit v1.2.3