@@ -75,15 +75,15 @@ void CInstantSendManager::Start(PeerManager& peerman)
7575
7676 workThread = std::thread (&util::TraceThread, " isman" , [this , &peerman] { WorkThreadMain (peerman); });
7777
78- if (m_signer) {
79- m_signer ->Start ();
78+ if (auto signer = m_signer. load (std::memory_order_acquire); signer ) {
79+ signer ->Start ();
8080 }
8181}
8282
8383void CInstantSendManager::Stop ()
8484{
85- if (m_signer) {
86- m_signer ->Stop ();
85+ if (auto signer = m_signer. load (std::memory_order_acquire); signer ) {
86+ signer ->Stop ();
8787 }
8888
8989 // make sure to call InterruptWorkerThread() first
@@ -348,8 +348,8 @@ MessageProcessingResult CInstantSendManager::ProcessInstantSendLock(NodeId from,
348348 LogPrint (BCLog::INSTANTSEND, " CInstantSendManager::%s -- txid=%s, islock=%s: processing islock, peer=%d\n " ,
349349 __func__, islock->txid .ToString (), hash.ToString (), from);
350350
351- if (m_signer) {
352- m_signer ->ClearLockFromQueue (islock);
351+ if (auto signer = m_signer. load (std::memory_order_acquire); signer ) {
352+ signer ->ClearLockFromQueue (islock);
353353 }
354354 if (db.KnownInstantSendLock (hash)) {
355355 return {};
@@ -449,8 +449,8 @@ void CInstantSendManager::TransactionAddedToMempool(const CTransactionRef& tx)
449449 }
450450
451451 if (islock == nullptr ) {
452- if (m_signer) {
453- m_signer ->ProcessTx (*tx, false , Params ().GetConsensus ());
452+ if (auto signer = m_signer. load (std::memory_order_acquire); signer ) {
453+ signer ->ProcessTx (*tx, false , Params ().GetConsensus ());
454454 }
455455 // TX is not locked, so make sure it is tracked
456456 AddNonLockedTx (tx, nullptr );
@@ -491,8 +491,8 @@ void CInstantSendManager::BlockConnected(const std::shared_ptr<const CBlock>& pb
491491 }
492492
493493 if (!IsLocked (tx->GetHash ()) && !has_chainlock) {
494- if (m_signer) {
495- m_signer ->ProcessTx (*tx, true , Params ().GetConsensus ());
494+ if (auto signer = m_signer. load (std::memory_order_acquire); signer ) {
495+ signer ->ProcessTx (*tx, true , Params ().GetConsensus ());
496496 }
497497 // TX is not locked, so make sure it is tracked
498498 AddNonLockedTx (tx, pindex);
@@ -597,16 +597,16 @@ void CInstantSendManager::RemoveNonLockedTx(const uint256& txid, bool retryChild
597597void CInstantSendManager::RemoveConflictedTx (const CTransaction& tx)
598598{
599599 RemoveNonLockedTx (tx.GetHash (), false );
600- if (m_signer) {
601- m_signer ->ClearInputsFromQueue (GetIdsFromLockable (tx.vin ));
600+ if (auto signer = m_signer. load (std::memory_order_acquire); signer ) {
601+ signer ->ClearInputsFromQueue (GetIdsFromLockable (tx.vin ));
602602 }
603603}
604604
605605void CInstantSendManager::TruncateRecoveredSigsForInputs (const instantsend::InstantSendLock& islock)
606606{
607607 auto ids = GetIdsFromLockable (islock.inputs );
608- if (m_signer) {
609- m_signer ->ClearInputsFromQueue (ids);
608+ if (auto signer = m_signer. load (std::memory_order_acquire); signer ) {
609+ signer ->ClearInputsFromQueue (ids);
610610 }
611611 for (const auto & id : ids) {
612612 sigman.TruncateRecoveredSig (Params ().GetConsensus ().llmqTypeDIP0024InstantSend , id);
@@ -925,7 +925,8 @@ void CInstantSendManager::WorkThreadMain(PeerManager& peerman)
925925 for (auto & [node_id, mpr] : peer_activity) {
926926 peerman.PostProcessMessage (std::move (mpr), node_id);
927927 }
928- if (!m_signer) return more_work;
928+ auto signer = m_signer.load (std::memory_order_acquire);
929+ if (!signer) return more_work;
929930 // Construct set of non-locked transactions that are pending to retry
930931 std::vector<CTransactionRef> txns{};
931932 {
@@ -942,7 +943,7 @@ void CInstantSendManager::WorkThreadMain(PeerManager& peerman)
942943 }
943944 }
944945 // Retry processing them
945- m_signer ->ProcessPendingRetryLockTxs (txns);
946+ signer ->ProcessPendingRetryLockTxs (txns);
946947 return more_work;
947948 }();
948949
0 commit comments