From 7ec3281416e1501dc276f73ce67c4c09dafbfd2d Mon Sep 17 00:00:00 2001 From: levonpetrosyan93 Date: Fri, 18 Oct 2024 04:11:26 +0400 Subject: [PATCH] QT hanging fix --- src/qt/masternodelist.cpp | 4 +++- src/qt/transactiondesc.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index 685a845434..3911ee295e 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -165,7 +165,9 @@ void MasternodeList::updateDIP3List() { // Get all UTXOs for each MN collateral in one go so that we can reduce locking overhead for cs_main // We also do this outside of the below Qt list update loop to reduce cs_main locking time to a minimum - LOCK(cs_main); + TRY_LOCK(cs_main,lock_main); + if (!lock_main) + return; mnList.ForEachMN(false, [&](const CDeterministicMNCPtr& dmn) { CTxDestination collateralDest; Coin coin; diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index a13eb7e347..1a15a1ab52 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -72,7 +72,12 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco { QString strHTML; - LOCK2(cs_main, wallet->cs_wallet); + TRY_LOCK(cs_main,lock_main); + if (!lock_main) + return strHTML; + TRY_LOCK(wallet->cs_wallet,lock_wallet); + if (!lock_wallet) + return strHTML; strHTML.reserve(4000); strHTML += "";