Go back to taking both main+wallet lock in DecrementWitnesses
By taking a wallet lock first and then main later we run into a potential deadlock : 2024-09-13 11:14:37 POTENTIAL DEADLOCK DETECTED 2024-09-13 11:14:37 Previous lock order was: 2024-09-13 11:14:37 (1) cs_wallet wallet/wallet.cpp:985 2024-09-13 11:14:37 (2) cs_main wallet/wallet.cpp:890 2024-09-13 11:14:37 Current lock order is: 2024-09-13 11:14:37 (2) cs_main wallet/wallet.cpp:2845 2024-09-13 11:14:37 (1) cs_wallet wallet/wallet.cpp:2845
This commit is contained in:
@@ -887,7 +887,6 @@ bool CWallet::IsSaplingSpent(const uint256& nullifier) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CWallet::GetSaplingSpendDepth(const uint256& nullifier) const {
|
unsigned int CWallet::GetSaplingSpendDepth(const uint256& nullifier) const {
|
||||||
LOCK(cs_main);
|
|
||||||
|
|
||||||
pair<TxNullifiers::const_iterator, TxNullifiers::const_iterator> range;
|
pair<TxNullifiers::const_iterator, TxNullifiers::const_iterator> range;
|
||||||
range = mapTxSaplingNullifiers.equal_range(nullifier);
|
range = mapTxSaplingNullifiers.equal_range(nullifier);
|
||||||
@@ -979,10 +978,9 @@ void CWallet::ClearNoteWitnessCache()
|
|||||||
|
|
||||||
void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex)
|
void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex)
|
||||||
{
|
{
|
||||||
|
|
||||||
extern int32_t HUSH_REWIND;
|
extern int32_t HUSH_REWIND;
|
||||||
|
|
||||||
LOCK(cs_wallet);
|
LOCK2(cs_main, cs_wallet);
|
||||||
|
|
||||||
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||||
//Sapling
|
//Sapling
|
||||||
|
|||||||
Reference in New Issue
Block a user