@@ -25,12 +25,12 @@ CPrivateSendClientManager privateSendClient;
2525void CPrivateSendClientManager::ProcessMessage (CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
2626{
2727 if (fMasternodeMode ) return ;
28- if (fLiteMode ) return ; // ignore all Dash related functionality
28+ if (! fEnablePrivateSend ) return ;
2929 if (!masternodeSync.IsBlockchainSynced ()) return ;
3030
3131 if (!CheckDiskSpace ()) {
3232 ResetPool ();
33- fEnablePrivateSend = false ;
33+ fPrivateSendRunning = false ;
3434 LogPrintf (" CPrivateSendClientManager::ProcessMessage -- Not enough disk space, disabling PrivateSend.\n " );
3535 return ;
3636 }
@@ -131,7 +131,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string&
131131void CPrivateSendClientSession::ProcessMessage (CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
132132{
133133 if (fMasternodeMode ) return ;
134- if (fLiteMode ) return ; // ignore all Dash related functionality
134+ if (!privateSendClient. fEnablePrivateSend ) return ;
135135 if (!masternodeSync.IsBlockchainSynced ()) return ;
136136
137137 if (strCommand == NetMsgType::DSSTATUSUPDATE) {
@@ -265,7 +265,7 @@ void CPrivateSendClientSession::SetNull()
265265//
266266void CPrivateSendClientSession::UnlockCoins ()
267267{
268- if (!pwalletMain ) return ;
268+ if (!privateSendClient. fEnablePrivateSend ) return ;
269269
270270 while (true ) {
271271 TRY_LOCK (pwalletMain->cs_wallet , lockWallet);
@@ -428,7 +428,7 @@ void CPrivateSendClientManager::CheckTimeout()
428428
429429 CheckQueue ();
430430
431- if (!fEnablePrivateSend ) return ;
431+ if (!fEnablePrivateSend || ! fPrivateSendRunning ) return ;
432432
433433 LOCK (cs_deqsessions);
434434 for (auto & session : deqSessions) {
@@ -548,7 +548,7 @@ bool CPrivateSendClientSession::CheckPoolStateUpdate(CPrivateSendStatusUpdate ps
548548//
549549bool CPrivateSendClientSession::SignFinalTransaction (const CTransaction& finalTransactionNew, CNode* pnode, CConnman& connman)
550550{
551- if (!pwalletMain ) return false ;
551+ if (!privateSendClient. fEnablePrivateSend || !privateSendClient. fPrivateSendRunning ) return false ;
552552
553553 if (fMasternodeMode || pnode == nullptr ) return false ;
554554 if (!mixingMasternode) return false ;
@@ -699,18 +699,13 @@ bool CPrivateSendClientManager::WaitForAnotherBlock()
699699
700700bool CPrivateSendClientManager::CheckAutomaticBackup ()
701701{
702- if (!pwalletMain) {
703- LogPrint (BCLog::PRIVATESEND, " CPrivateSendClientManager::CheckAutomaticBackup -- Wallet is not initialized, no mixing available.\n " );
704- strAutoDenomResult = _ (" Wallet is not initialized" ) + " , " + _ (" no mixing available." );
705- fEnablePrivateSend = false ; // no mixing
706- return false ;
707- }
702+ if (!fEnablePrivateSend || !fPrivateSendRunning ) return false ;
708703
709704 switch (nWalletBackups) {
710705 case 0 :
711706 LogPrint (BCLog::PRIVATESEND, " CPrivateSendClientManager::CheckAutomaticBackup -- Automatic backups disabled, no mixing available.\n " );
712707 strAutoDenomResult = _ (" Automatic backups disabled" ) + " , " + _ (" no mixing available." );
713- fEnablePrivateSend = false ; // stop mixing
708+ fPrivateSendRunning = false ; // stop mixing
714709 pwalletMain->nKeysLeftSinceAutoBackup = 0 ; // no backup, no "keys since last backup"
715710 return false ;
716711 case -1 :
@@ -734,7 +729,7 @@ bool CPrivateSendClientManager::CheckAutomaticBackup()
734729 LogPrint (BCLog::PRIVATESEND, " CPrivateSendClientManager::CheckAutomaticBackup -- Very low number of keys left: %d, no mixing available.\n " , pwalletMain->nKeysLeftSinceAutoBackup );
735730 strAutoDenomResult = strprintf (_ (" Very low number of keys left: %d" ) + " , " + _ (" no mixing available." ), pwalletMain->nKeysLeftSinceAutoBackup );
736731 // It's getting really dangerous, stop mixing
737- fEnablePrivateSend = false ;
732+ fPrivateSendRunning = false ;
738733 return false ;
739734 } else if (pwalletMain->nKeysLeftSinceAutoBackup < PRIVATESEND_KEYS_THRESHOLD_WARNING) {
740735 // Low number of keys left but it's still more or less safe to continue
@@ -782,10 +777,7 @@ bool CPrivateSendClientSession::DoAutomaticDenominating(CConnman& connman, bool
782777 return false ;
783778 }
784779
785- if (!pwalletMain) {
786- strAutoDenomResult = _ (" Wallet is not initialized" );
787- return false ;
788- }
780+ if (!privateSendClient.fEnablePrivateSend || !privateSendClient.fPrivateSendRunning ) return false ;
789781
790782 CAmount nBalanceNeedsAnonymized;
791783
@@ -953,18 +945,13 @@ bool CPrivateSendClientSession::DoAutomaticDenominating(CConnman& connman, bool
953945bool CPrivateSendClientManager::DoAutomaticDenominating (CConnman& connman, bool fDryRun )
954946{
955947 if (fMasternodeMode ) return false ; // no client-side mixing on masternodes
956- if (!fEnablePrivateSend ) return false ;
948+ if (!fEnablePrivateSend || ! fPrivateSendRunning ) return false ;
957949
958950 if (!masternodeSync.IsBlockchainSynced ()) {
959951 strAutoDenomResult = _ (" Can't mix while sync in progress." );
960952 return false ;
961953 }
962954
963- if (!pwalletMain) {
964- strAutoDenomResult = _ (" Wallet is not initialized" );
965- return false ;
966- }
967-
968955 if (!fDryRun && pwalletMain->IsLocked (true )) {
969956 strAutoDenomResult = _ (" Wallet is locked." );
970957 return false ;
@@ -1048,7 +1035,7 @@ CDeterministicMNCPtr CPrivateSendClientManager::GetRandomNotUsedMasternode()
10481035
10491036bool CPrivateSendClientSession::JoinExistingQueue (CAmount nBalanceNeedsAnonymized, CConnman& connman)
10501037{
1051- if (!pwalletMain ) return false ;
1038+ if (!privateSendClient. fEnablePrivateSend || !privateSendClient. fPrivateSendRunning ) return false ;
10521039
10531040 auto mnList = deterministicMNManager->GetListAtChainTip ();
10541041
@@ -1116,7 +1103,7 @@ bool CPrivateSendClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymize
11161103
11171104bool CPrivateSendClientSession::StartNewQueue (CAmount nBalanceNeedsAnonymized, CConnman& connman)
11181105{
1119- if (!pwalletMain ) return false ;
1106+ if (!privateSendClient. fEnablePrivateSend || !privateSendClient. fPrivateSendRunning ) return false ;
11201107 if (nBalanceNeedsAnonymized <= 0 ) return false ;
11211108
11221109 int nTries = 0 ;
@@ -1283,10 +1270,7 @@ bool CPrivateSendClientSession::SubmitDenominate(CConnman& connman)
12831270
12841271bool CPrivateSendClientSession::SelectDenominate (std::string& strErrorRet, std::vector<std::pair<CTxDSIn, CTxOut> >& vecPSInOutPairsRet)
12851272{
1286- if (!pwalletMain) {
1287- strErrorRet = " Wallet is not initialized" ;
1288- return false ;
1289- }
1273+ if (!privateSendClient.fEnablePrivateSend || !privateSendClient.fPrivateSendRunning ) return false ;
12901274
12911275 if (pwalletMain->IsLocked (true )) {
12921276 strErrorRet = " Wallet locked, unable to create transaction!" ;
@@ -1392,7 +1376,7 @@ bool CPrivateSendClientSession::PrepareDenominate(int nMinRounds, int nMaxRounds
13921376// Create collaterals by looping through inputs grouped by addresses
13931377bool CPrivateSendClientSession::MakeCollateralAmounts (CConnman& connman)
13941378{
1395- if (!pwalletMain ) return false ;
1379+ if (!privateSendClient. fEnablePrivateSend || !privateSendClient. fPrivateSendRunning ) return false ;
13961380
13971381 std::vector<CompactTallyItem> vecTally;
13981382 if (!pwalletMain->SelectCoinsGroupedByAddresses (vecTally, false , false )) {
@@ -1425,7 +1409,7 @@ bool CPrivateSendClientSession::MakeCollateralAmounts(CConnman& connman)
14251409// Split up large inputs or create fee sized inputs
14261410bool CPrivateSendClientSession::MakeCollateralAmounts (const CompactTallyItem& tallyItem, bool fTryDenominated , CConnman& connman)
14271411{
1428- if (!pwalletMain ) return false ;
1412+ if (!privateSendClient. fEnablePrivateSend || !privateSendClient. fPrivateSendRunning ) return false ;
14291413
14301414 LOCK2 (cs_main, pwalletMain->cs_wallet );
14311415
@@ -1501,7 +1485,7 @@ bool CPrivateSendClientSession::MakeCollateralAmounts(const CompactTallyItem& ta
15011485// Create denominations by looping through inputs grouped by addresses
15021486bool CPrivateSendClientSession::CreateDenominated (CAmount nBalanceToDenominate, CConnman& connman)
15031487{
1504- if (!pwalletMain ) return false ;
1488+ if (!privateSendClient. fEnablePrivateSend || !privateSendClient. fPrivateSendRunning ) return false ;
15051489
15061490 LOCK2 (cs_main, pwalletMain->cs_wallet );
15071491
@@ -1534,7 +1518,7 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate,
15341518// Create denominations
15351519bool CPrivateSendClientSession::CreateDenominated (CAmount nBalanceToDenominate, const CompactTallyItem& tallyItem, bool fCreateMixingCollaterals , CConnman& connman)
15361520{
1537- if (!pwalletMain ) return false ;
1521+ if (!privateSendClient. fEnablePrivateSend || !privateSendClient. fPrivateSendRunning ) return false ;
15381522
15391523 std::vector<CRecipient> vecSend;
15401524 CKeyHolderStorage keyHolderStorageDenom;
@@ -1679,7 +1663,7 @@ void CPrivateSendClientManager::UpdatedBlockTip(const CBlockIndex* pindex)
16791663
16801664void CPrivateSendClientManager::DoMaintenance (CConnman& connman)
16811665{
1682- if (fLiteMode ) return ; // disable all Dash specific functionality
1666+ if (! fEnablePrivateSend ) return ;
16831667 if (fMasternodeMode ) return ; // no client-side mixing on masternodes
16841668
16851669 if (!masternodeSync.IsBlockchainSynced () || ShutdownRequested ()) return ;
0 commit comments