From 7f9878cf0cf8973a87837f4500d1671383573b82 Mon Sep 17 00:00:00 2001 From: Duke Date: Thu, 12 Sep 2024 11:47:58 -0400 Subject: [PATCH] Take a lock on cs_main in DecrementNoteWitnesses Another possibly better approach would be to take a lock inside GetSaplingSpendDepth since we want the lock to apply to as little code as possible and it is GetSaplingSpendDepth that calls GetDepthInMainChain which requires a cs_main lock . --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 18e38cb0c..6d8c78979 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -977,7 +977,7 @@ void CWallet::ClearNoteWitnessCache() void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex) { - LOCK(cs_wallet); + LOCK2(cs_main, cs_wallet); extern int32_t HUSH_REWIND;