diff --git a/src/net_processing.cpp b/src/net_processing.cpp index cbc95fb4bc..ffe5e7e480 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2114,7 +2114,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr return false; } - LogPrintf("DSTX -- Got Masternode transaction %s\n", hashTx.ToString()); + LogPrint(BCLog::PRIVATESEND, "DSTX -- Got Masternode transaction %s\n", hashTx.ToString()); mempool.PrioritiseTransaction(hashTx, 0.1*COIN); mmetaman.DisallowMixing(dmn->proTxHash); } @@ -2127,7 +2127,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr if (!AlreadyHave(inv) && AcceptToMemoryPool(mempool, state, ptx, true, &fMissingInputs)) { // Process custom txes, this changes AlreadyHave to "true" if (nInvType == MSG_DSTX) { - LogPrintf("DSTX -- Masternode transaction accepted, txid=%s, peer=%d\n", + LogPrint(BCLog::PRIVATESEND, "DSTX -- Masternode transaction accepted, txid=%s, peer=%d\n", tx.GetHash().ToString(), pfrom->GetId()); CPrivateSend::AddDSTX(dstx); } diff --git a/src/privatesend/privatesend-client.cpp b/src/privatesend/privatesend-client.cpp index 7cf50df587..0ca54b0084 100644 --- a/src/privatesend/privatesend-client.cpp +++ b/src/privatesend/privatesend-client.cpp @@ -31,7 +31,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string& if (!CheckDiskSpace()) { ResetPool(); fPrivateSendRunning = false; - LogPrintf("CPrivateSendClientManager::ProcessMessage -- Not enough disk space, disabling PrivateSend.\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientManager::ProcessMessage -- Not enough disk space, disabling PrivateSend.\n"); return; } @@ -143,7 +143,7 @@ void CPrivateSendClientSession::ProcessMessage(CNode* pfrom, const std::string& if (!mixingMasternode) return; if (mixingMasternode->pdmnState->addr != pfrom->addr) { - //LogPrintf("DSSTATUSUPDATE -- message doesn't match current Masternode: infoMixingMasternode %s addr %s\n", infoMixingMasternode.addr.ToString(), pfrom->addr.ToString()); + //LogPrint(BCLog::PRIVATESEND, "DSSTATUSUPDATE -- message doesn't match current Masternode: infoMixingMasternode %s addr %s\n", infoMixingMasternode.addr.ToString(), pfrom->addr.ToString()); return; } @@ -181,7 +181,7 @@ void CPrivateSendClientSession::ProcessMessage(CNode* pfrom, const std::string& if (!mixingMasternode) return; if (mixingMasternode->pdmnState->addr != pfrom->addr) { - //LogPrintf("DSFINALTX -- message doesn't match current Masternode: infoMixingMasternode %s addr %s\n", infoMixingMasternode.addr.ToString(), pfrom->addr.ToString()); + //LogPrint(BCLog::PRIVATESEND, "DSFINALTX -- message doesn't match current Masternode: infoMixingMasternode %s addr %s\n", infoMixingMasternode.addr.ToString(), pfrom->addr.ToString()); return; } @@ -445,12 +445,12 @@ void CPrivateSendClientManager::CheckTimeout() bool CPrivateSendClientSession::SendDenominate(const std::vector >& vecPSInOutPairsIn, CConnman& connman) { if (fMasternodeMode) { - LogPrintf("CPrivateSendClientSession::SendDenominate -- PrivateSend from a Masternode is not supported currently.\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SendDenominate -- PrivateSend from a Masternode is not supported currently.\n"); return false; } if (txMyCollateral == CMutableTransaction()) { - LogPrintf("CPrivateSendClient:SendDenominate -- PrivateSend collateral not set\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClient:SendDenominate -- PrivateSend collateral not set\n"); return false; } @@ -465,7 +465,7 @@ bool CPrivateSendClientSession::SendDenominate(const std::vector vecTxDSInTmp; @@ -496,7 +496,7 @@ bool CPrivateSendClientSession::SendDenominate(const std::vectorproTxHash.ToString()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SignFinalTransaction -- WARNING! Masternode %s is not BIP69 compliant!\n", mixingMasternode->proTxHash.ToString()); UnlockCoins(); keyHolderStorage.ReturnAll(); SetNull(); @@ -608,7 +608,7 @@ bool CPrivateSendClientSession::SignFinalTransaction(const CTransaction& finalTr if (nFoundOutputsCount < nTargetOuputsCount || nValue1 != nValue2) { // in this case, something went wrong and we'll refuse to sign. It's possible we'll be charged collateral. But that's // better then signing if the transaction doesn't look like what we wanted. - LogPrintf("CPrivateSendClientSession::SignFinalTransaction -- My entries are not correct! Refusing to sign: nFoundOutputsCount: %d, nTargetOuputsCount: %d\n", nFoundOutputsCount, nTargetOuputsCount); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SignFinalTransaction -- My entries are not correct! Refusing to sign: nFoundOutputsCount: %d, nTargetOuputsCount: %d\n", nFoundOutputsCount, nTargetOuputsCount); UnlockCoins(); keyHolderStorage.ReturnAll(); SetNull(); @@ -631,7 +631,7 @@ bool CPrivateSendClientSession::SignFinalTransaction(const CTransaction& finalTr } if (sigs.empty()) { - LogPrintf("CPrivateSendClientSession::SignFinalTransaction -- can't sign anything!\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SignFinalTransaction -- can't sign anything!\n"); UnlockCoins(); keyHolderStorage.ReturnAll(); SetNull(); @@ -640,7 +640,7 @@ bool CPrivateSendClientSession::SignFinalTransaction(const CTransaction& finalTr } // push all of our signatures to the Masternode - LogPrintf("CPrivateSendClientSession::SignFinalTransaction -- pushing sigs to the masternode, finalMutableTransaction=%s", finalMutableTransaction.ToString()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SignFinalTransaction -- pushing sigs to the masternode, finalMutableTransaction=%s", finalMutableTransaction.ToString()); CNetMsgMaker msgMaker(pnode->GetSendVersion()); connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSSIGNFINALTX, sigs)); SetState(POOL_STATE_SIGNING); @@ -655,11 +655,11 @@ void CPrivateSendClientSession::CompletedTransaction(PoolMessage nMessageID) if (fMasternodeMode) return; if (nMessageID == MSG_SUCCESS) { - LogPrintf("CompletedTransaction -- success\n"); + LogPrint(BCLog::PRIVATESEND, "CompletedTransaction -- success\n"); privateSendClient.UpdatedSuccessBlock(); keyHolderStorage.KeepAll(); } else { - LogPrintf("CompletedTransaction -- error\n"); + LogPrint(BCLog::PRIVATESEND, "CompletedTransaction -- error\n"); keyHolderStorage.ReturnAll(); } UnlockCoins(); @@ -744,11 +744,11 @@ bool CPrivateSendClientManager::CheckAutomaticBackup() if (!AutoBackupWallet(vpwallets[0], "", warningString, errorString)) { if (!warningString.empty()) { // There were some issues saving backup but yet more or less safe to continue - LogPrintf("CPrivateSendClientManager::CheckAutomaticBackup -- WARNING! Something went wrong on automatic backup: %s\n", warningString); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientManager::CheckAutomaticBackup -- WARNING! Something went wrong on automatic backup: %s\n", warningString); } if (!errorString.empty()) { // Things are really broken - LogPrintf("CPrivateSendClientManager::CheckAutomaticBackup -- ERROR! Failed to create automatic backup: %s\n", errorString); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientManager::CheckAutomaticBackup -- ERROR! Failed to create automatic backup: %s\n", errorString); strAutoDenomResult = strprintf(_("ERROR! Failed to create automatic backup") + ": %s", errorString); return false; } @@ -829,7 +829,7 @@ bool CPrivateSendClientSession::DoAutomaticDenominating(CConnman& connman, bool // anonymizable balance is way too small if (nBalanceAnonymizable < nValueMin) { - LogPrintf("CPrivateSendClientSession::DoAutomaticDenominating -- Not enough funds to anonymize\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::DoAutomaticDenominating -- Not enough funds to anonymize\n"); strAutoDenomResult = _("Not enough funds to anonymize."); return false; } @@ -904,7 +904,7 @@ bool CPrivateSendClientSession::DoAutomaticDenominating(CConnman& connman, bool // should be no unconfirmed denoms in non-multi-session mode if (!privateSendClient.fPrivateSendMultiSession && nBalanceDenominatedUnconf > 0) { - LogPrintf("CPrivateSendClientSession::DoAutomaticDenominating -- Found unconfirmed denominated outputs, will wait till they confirm to continue.\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::DoAutomaticDenominating -- Found unconfirmed denominated outputs, will wait till they confirm to continue.\n"); strAutoDenomResult = _("Found unconfirmed denominated outputs, will wait till they confirm to continue."); return false; } @@ -913,14 +913,14 @@ bool CPrivateSendClientSession::DoAutomaticDenominating(CConnman& connman, bool std::string strReason; if (txMyCollateral == CMutableTransaction()) { if (!vpwallets[0]->CreateCollateralTransaction(txMyCollateral, strReason)) { - LogPrintf("CPrivateSendClientSession::DoAutomaticDenominating -- create collateral error:%s\n", strReason); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::DoAutomaticDenominating -- create collateral error:%s\n", strReason); return false; } } else { if (!CPrivateSend::IsCollateralValid(txMyCollateral)) { - LogPrintf("CPrivateSendClientSession::DoAutomaticDenominating -- invalid collateral, recreating...\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::DoAutomaticDenominating -- invalid collateral, recreating...\n"); if (!vpwallets[0]->CreateCollateralTransaction(txMyCollateral, strReason)) { - LogPrintf("CPrivateSendClientSession::DoAutomaticDenominating -- create collateral error: %s\n", strReason); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::DoAutomaticDenominating -- create collateral error: %s\n", strReason); return false; } } @@ -978,7 +978,7 @@ bool CPrivateSendClientManager::DoAutomaticDenominating(CConnman& connman, bool if (!CheckAutomaticBackup()) return false; if (WaitForAnotherBlock()) { - LogPrintf("CPrivateSendClientManager::DoAutomaticDenominating -- Last successful PrivateSend action was too recent\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientManager::DoAutomaticDenominating -- Last successful PrivateSend action was too recent\n"); strAutoDenomResult = _("Last successful PrivateSend action was too recent."); return false; } @@ -1001,7 +1001,7 @@ CDeterministicMNCPtr CPrivateSendClientManager::GetRandomNotUsedMasternode() int nCountEnabled = mnList.GetValidMNsCount(); int nCountNotExcluded = nCountEnabled - vecMasternodesUsed.size(); - LogPrintf("CPrivateSendClientManager::%s -- %d enabled masternodes, %d masternodes to choose from\n", __func__, nCountEnabled, nCountNotExcluded); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientManager::%s -- %d enabled masternodes, %d masternodes to choose from\n", __func__, nCountEnabled, nCountNotExcluded); if(nCountNotExcluded < 1) { return nullptr; } @@ -1046,13 +1046,13 @@ bool CPrivateSendClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymize auto dmn = mnList.GetValidMNByCollateral(dsq.masternodeOutpoint); if (!dmn) { - LogPrintf("CPrivateSendClientSession::JoinExistingQueue -- dsq masternode is not in masternode list, masternode=%s\n", dsq.masternodeOutpoint.ToStringShort()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::JoinExistingQueue -- dsq masternode is not in masternode list, masternode=%s\n", dsq.masternodeOutpoint.ToStringShort()); continue; } // skip next mn payments winners if (mnpayments.IsScheduled(dmn, 0)) { - LogPrintf("CPrivateSendClientSession::JoinExistingQueue -- skipping winner, masternode=%s\n", dmn->proTxHash.ToString()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::JoinExistingQueue -- skipping winner, masternode=%s\n", dmn->proTxHash.ToString()); continue; } @@ -1074,14 +1074,14 @@ bool CPrivateSendClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymize // Try to match their denominations if possible, select exact number of denominations if (!vpwallets[0]->SelectPSInOutPairsByDenominations(dsq.nDenom, nMinAmount, nMaxAmount, vecPSInOutPairsTmp)) { - LogPrintf("CPrivateSendClientSession::JoinExistingQueue -- Couldn't match %d denominations %d (%s)\n", vecBits.front(), dsq.nDenom, CPrivateSend::GetDenominationsToString(dsq.nDenom)); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::JoinExistingQueue -- Couldn't match %d denominations %d (%s)\n", vecBits.front(), dsq.nDenom, CPrivateSend::GetDenominationsToString(dsq.nDenom)); continue; } privateSendClient.AddUsedMasternode(dsq.masternodeOutpoint); if (connman.IsMasternodeOrDisconnectRequested(dmn->pdmnState->addr)) { - LogPrintf("CPrivateSendClientSession::JoinExistingQueue -- skipping masternode connection, addr=%s\n", dmn->pdmnState->addr.ToString()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::JoinExistingQueue -- skipping masternode connection, addr=%s\n", dmn->pdmnState->addr.ToString()); continue; } @@ -1092,7 +1092,7 @@ bool CPrivateSendClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymize // TODO: add new state POOL_STATE_CONNECTING and bump MIN_PRIVATESEND_PEER_PROTO_VERSION SetState(POOL_STATE_QUEUE); nTimeLastSuccessfulStep = GetTime(); - LogPrintf("CPrivateSendClientSession::JoinExistingQueue -- pending connection (from queue): nSessionDenom: %d (%s), addr=%s\n", + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::JoinExistingQueue -- pending connection (from queue): nSessionDenom: %d (%s), addr=%s\n", nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), dmn->pdmnState->addr.ToString()); strAutoDenomResult = _("Trying to connect..."); return true; @@ -1114,7 +1114,7 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, C CAmount nValueInTmp = 0; if (!vpwallets[0]->SelectPrivateCoins(CPrivateSend::GetSmallestDenomination(), nBalanceNeedsAnonymized, vecTxIn, nValueInTmp, 0, privateSendClient.nPrivateSendRounds - 1)) { // this should never happen - LogPrintf("CPrivateSendClientSession::StartNewQueue -- Can't mix: no compatible inputs found!\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::StartNewQueue -- Can't mix: no compatible inputs found!\n"); strAutoDenomResult = _("Can't mix: no compatible inputs found!"); return false; } @@ -1124,7 +1124,7 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, C auto dmn = privateSendClient.GetRandomNotUsedMasternode(); if (!dmn) { - LogPrintf("CPrivateSendClientSession::StartNewQueue -- Can't find random masternode!\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::StartNewQueue -- Can't find random masternode!\n"); strAutoDenomResult = _("Can't find random Masternode."); return false; } @@ -1133,14 +1133,14 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, C // skip next mn payments winners if (mnpayments.IsScheduled(dmn, 0)) { - LogPrintf("CPrivateSendClientSession::StartNewQueue -- skipping winner, masternode=%s\n", dmn->proTxHash.ToString()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::StartNewQueue -- skipping winner, masternode=%s\n", dmn->proTxHash.ToString()); nTries++; continue; } int64_t nLastDsq = mmetaman.GetMetaInfo(dmn->proTxHash)->GetLastDsq(); if (nLastDsq != 0 && nLastDsq + nMnCount / 5 > mmetaman.GetDsqCount()) { - LogPrintf("CPrivateSendClientSession::StartNewQueue -- Too early to mix on this masternode!" + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::StartNewQueue -- Too early to mix on this masternode!" " masternode=%s addr=%s nLastDsq=%d CountEnabled/5=%d nDsqCount=%d\n", dmn->proTxHash.ToString(), dmn->pdmnState->addr.ToString(), nLastDsq, nMnCount / 5, mmetaman.GetDsqCount()); @@ -1149,12 +1149,12 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, C } if (connman.IsMasternodeOrDisconnectRequested(dmn->pdmnState->addr)) { - LogPrintf("CPrivateSendClientSession::StartNewQueue -- skipping masternode connection, addr=%s\n", dmn->pdmnState->addr.ToString()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::StartNewQueue -- skipping masternode connection, addr=%s\n", dmn->pdmnState->addr.ToString()); nTries++; continue; } - LogPrintf("CPrivateSendClientSession::StartNewQueue -- attempt %d connection to Masternode %s\n", nTries, dmn->pdmnState->addr.ToString()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::StartNewQueue -- attempt %d connection to Masternode %s\n", nTries, dmn->pdmnState->addr.ToString()); std::vector vecAmounts; vpwallets[0]->ConvertList(vecTxIn, vecAmounts); @@ -1169,7 +1169,7 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, C // TODO: add new state POOL_STATE_CONNECTING and bump MIN_PRIVATESEND_PEER_PROTO_VERSION SetState(POOL_STATE_QUEUE); nTimeLastSuccessfulStep = GetTime(); - LogPrintf("CPrivateSendClientSession::StartNewQueue -- pending connection, nSessionDenom: %d (%s), addr=%s\n", + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::StartNewQueue -- pending connection, nSessionDenom: %d (%s), addr=%s\n", nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), dmn->pdmnState->addr.ToString()); strAutoDenomResult = _("Trying to connect..."); return true; @@ -1220,7 +1220,7 @@ bool CPrivateSendClientSession::SubmitDenominate(CConnman& connman) std::vector > vecPSInOutPairs, vecPSInOutPairsTmp; if (!SelectDenominate(strError, vecPSInOutPairs)) { - LogPrintf("CPrivateSendClientSession::SubmitDenominate -- SelectDenominate failed, error: %s\n", strError); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SubmitDenominate -- SelectDenominate failed, error: %s\n", strError); return false; } @@ -1230,7 +1230,7 @@ bool CPrivateSendClientSession::SubmitDenominate(CConnman& connman) for (int i = 0; i < privateSendClient.nPrivateSendRounds; i++) { if (PrepareDenominate(i, i, strError, vecPSInOutPairs, vecPSInOutPairsTmp, fDryRun)) { - LogPrintf("CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for %d rounds, success\n", i); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for %d rounds, success\n", i); if (!fDryRun) { return SendDenominate(vecPSInOutPairsTmp, connman); } @@ -1252,18 +1252,18 @@ bool CPrivateSendClientSession::SubmitDenominate(CConnman& connman) int nRounds = vecInputsByRounds.begin()->first; if (PrepareDenominate(nRounds, nRounds, strError, vecPSInOutPairs, vecPSInOutPairsTmp)) { - LogPrintf("CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for %d rounds, success\n", nRounds); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for %d rounds, success\n", nRounds); return SendDenominate(vecPSInOutPairsTmp, connman); } // We failed? That's strange but let's just make final attempt and try to mix everything if (PrepareDenominate(0, privateSendClient.nPrivateSendRounds - 1, strError, vecPSInOutPairs, vecPSInOutPairsTmp)) { - LogPrintf("CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for all rounds, success\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for all rounds, success\n"); return SendDenominate(vecPSInOutPairsTmp, connman); } // Should never actually get here but just in case - LogPrintf("CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for all rounds, error: %s\n", strError); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for all rounds, error: %s\n", strError); strAutoDenomResult = strError; return false; } @@ -1402,7 +1402,7 @@ bool CPrivateSendClientSession::MakeCollateralAmounts(CConnman& connman) } // If we got here then smth is terribly broken actually - LogPrintf("CPrivateSendClientSession::MakeCollateralAmounts -- ERROR: Can't make collaterals!\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::MakeCollateralAmounts -- ERROR: Can't make collaterals!\n"); return false; } @@ -1449,13 +1449,13 @@ bool CPrivateSendClientSession::MakeCollateralAmounts(const CompactTallyItem& ta bool fSuccess = vpwallets[0]->CreateTransaction(vecSend, wtx, reservekeyChange, nFeeRet, nChangePosRet, strFail, &coinControl, true, ONLY_NONDENOMINATED); if (!fSuccess) { - LogPrintf("CPrivateSendClientSession::MakeCollateralAmounts -- ONLY_NONDENOMINATED: %s\n", strFail); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::MakeCollateralAmounts -- ONLY_NONDENOMINATED: %s\n", strFail); // If we failed then most likely there are not enough funds on this address. if (fTryDenominated) { // Try to also use denominated coins (we can't mix denominated without collaterals anyway). if (!vpwallets[0]->CreateTransaction(vecSend, wtx, reservekeyChange, nFeeRet, nChangePosRet, strFail, &coinControl, true, ALL_COINS)) { - LogPrintf("CPrivateSendClientSession::MakeCollateralAmounts -- ALL_COINS Error: %s\n", strFail); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::MakeCollateralAmounts -- ALL_COINS Error: %s\n", strFail); reservekeyCollateral.ReturnKey(); return false; } @@ -1468,12 +1468,12 @@ bool CPrivateSendClientSession::MakeCollateralAmounts(const CompactTallyItem& ta reservekeyCollateral.KeepKey(); - LogPrintf("CPrivateSendClientSession::MakeCollateralAmounts -- txid=%s\n", wtx.GetHash().GetHex()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::MakeCollateralAmounts -- txid=%s\n", wtx.GetHash().GetHex()); // use the same nCachedLastSuccessBlock as for DS mixing to prevent race CValidationState state; if (!vpwallets[0]->CommitTransaction(wtx, reservekeyChange, &connman, state)) { - LogPrintf("CPrivateSendClientSession::MakeCollateralAmounts -- CommitTransaction failed! Reason given: %s\n", state.GetRejectReason()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::MakeCollateralAmounts -- CommitTransaction failed! Reason given: %s\n", state.GetRejectReason()); return false; } @@ -1511,7 +1511,7 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, return true; } - LogPrintf("CPrivateSendClientSession::CreateDenominated -- failed!\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::CreateDenominated -- failed!\n"); return false; } @@ -1617,7 +1617,7 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, bool fSuccess = vpwallets[0]->CreateTransaction(vecSend, wtx, reservekeyChange, nFeeRet, nChangePosRet, strFail, &coinControl, true, ONLY_NONDENOMINATED); if (!fSuccess) { - LogPrintf("CPrivateSendClientSession::CreateDenominated -- Error: %s\n", strFail); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::CreateDenominated -- Error: %s\n", strFail); keyHolderStorageDenom.ReturnAll(); return false; } @@ -1626,13 +1626,13 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, CValidationState state; if (!vpwallets[0]->CommitTransaction(wtx, reservekeyChange, &connman, state)) { - LogPrintf("CPrivateSendClientSession::CreateDenominated -- CommitTransaction failed! Reason given: %s\n", state.GetRejectReason()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::CreateDenominated -- CommitTransaction failed! Reason given: %s\n", state.GetRejectReason()); return false; } // use the same nCachedLastSuccessBlock as for DS mixing to prevent race privateSendClient.UpdatedSuccessBlock(); - LogPrintf("CPrivateSendClientSession::CreateDenominated -- txid=%s\n", wtx.GetHash().GetHex()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::CreateDenominated -- txid=%s\n", wtx.GetHash().GetHex()); return true; } @@ -1642,7 +1642,7 @@ void CPrivateSendClientSession::RelayIn(const CPrivateSendEntry& entry, CConnman if (!mixingMasternode) return; connman.ForNode(mixingMasternode->pdmnState->addr, [&entry, &connman](CNode* pnode) { - LogPrintf("CPrivateSendClientSession::RelayIn -- found master, relaying message to %s\n", pnode->addr.ToString()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::RelayIn -- found master, relaying message to %s\n", pnode->addr.ToString()); CNetMsgMaker msgMaker(pnode->GetSendVersion()); connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSVIN, entry)); return true; @@ -1651,7 +1651,7 @@ void CPrivateSendClientSession::RelayIn(const CPrivateSendEntry& entry, CConnman void CPrivateSendClientSession::SetState(PoolState nStateNew) { - LogPrintf("CPrivateSendClientSession::SetState -- nState: %d, nStateNew: %d\n", nState, nStateNew); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::SetState -- nState: %d, nStateNew: %d\n", nState, nStateNew); nState = nStateNew; } diff --git a/src/privatesend/privatesend-server.cpp b/src/privatesend/privatesend-server.cpp index ca772b3864..7afea3914e 100644 --- a/src/privatesend/privatesend-server.cpp +++ b/src/privatesend/privatesend-server.cpp @@ -38,7 +38,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm if (IsSessionReady()) { // too many users in this session already, reject new ones - LogPrintf("DSACCEPT -- queue is already full!\n"); + LogPrint(BCLog::PRIVATESEND, "DSACCEPT -- queue is already full!\n"); PushStatus(pfrom, STATUS_REJECTED, ERR_QUEUE_FULL, connman); return; } @@ -72,7 +72,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm int64_t nLastDsq = mmetaman.GetMetaInfo(dmn->proTxHash)->GetLastDsq(); if (nLastDsq != 0 && nLastDsq + mnList.GetValidMNsCount() / 5 > mmetaman.GetDsqCount()) { - LogPrintf("DSACCEPT -- last dsq too recent, must wait: addr=%s\n", pfrom->addr.ToString()); + LogPrint(BCLog::PRIVATESEND, "DSACCEPT -- last dsq too recent, must wait: addr=%s\n", pfrom->addr.ToString()); PushStatus(pfrom, STATUS_REJECTED, ERR_RECENT, connman); return; } @@ -83,11 +83,11 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm bool fResult = nSessionID == 0 ? CreateNewSession(dsa, nMessageID, connman) : AddUserToExistingSession(dsa, nMessageID); if (fResult) { - LogPrintf("DSACCEPT -- is compatible, please submit!\n"); + LogPrint(BCLog::PRIVATESEND, "DSACCEPT -- is compatible, please submit!\n"); PushStatus(pfrom, STATUS_ACCEPTED, nMessageID, connman); return; } else { - LogPrintf("DSACCEPT -- not compatible with existing transactions!\n"); + LogPrint(BCLog::PRIVATESEND, "DSACCEPT -- not compatible with existing transactions!\n"); PushStatus(pfrom, STATUS_REJECTED, nMessageID, connman); return; } @@ -161,7 +161,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm //do we have enough users in the current session? if (!IsSessionReady()) { - LogPrintf("DSVIN -- session not complete!\n"); + LogPrint(BCLog::PRIVATESEND, "DSVIN -- session not complete!\n"); PushStatus(pfrom, STATUS_REJECTED, ERR_SESSION, connman); return; } @@ -172,14 +172,14 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm LogPrint(BCLog::PRIVATESEND, "DSVIN -- txCollateral %s", entry.txCollateral->ToString()); if (entry.vecTxDSIn.size() != entry.vecTxOut.size()) { - LogPrintf("DSVIN -- ERROR: inputs vs outputs size mismatch! %d vs %d\n", entry.vecTxDSIn.size(), entry.vecTxOut.size()); + LogPrint(BCLog::PRIVATESEND, "DSVIN -- ERROR: inputs vs outputs size mismatch! %d vs %d\n", entry.vecTxDSIn.size(), entry.vecTxOut.size()); PushStatus(pfrom, STATUS_REJECTED, ERR_SIZE_MISMATCH, connman); ConsumeCollateral(connman, entry.txCollateral); return; } if (entry.vecTxDSIn.size() > PRIVATESEND_ENTRY_MAX_SIZE) { - LogPrintf("DSVIN -- ERROR: too many inputs! %d/%d\n", entry.vecTxDSIn.size(), PRIVATESEND_ENTRY_MAX_SIZE); + LogPrint(BCLog::PRIVATESEND, "DSVIN -- ERROR: too many inputs! %d/%d\n", entry.vecTxDSIn.size(), PRIVATESEND_ENTRY_MAX_SIZE); PushStatus(pfrom, STATUS_REJECTED, ERR_MAXIMUM, connman); ConsumeCollateral(connman, entry.txCollateral); return; @@ -187,7 +187,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm // do we have the same denominations as the current session? if (!IsOutputsCompatibleWithSessionDenom(entry.vecTxOut)) { - LogPrintf("DSVIN -- not compatible with existing transactions!\n"); + LogPrint(BCLog::PRIVATESEND, "DSVIN -- not compatible with existing transactions!\n"); PushStatus(pfrom, STATUS_REJECTED, ERR_EXISTING_TX, connman); return; } @@ -204,13 +204,13 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm tx.vout.push_back(txout); if (txout.scriptPubKey.size() != 25) { - LogPrintf("DSVIN -- non-standard pubkey detected! scriptPubKey=%s\n", ScriptToAsmStr(txout.scriptPubKey)); + LogPrint(BCLog::PRIVATESEND, "DSVIN -- non-standard pubkey detected! scriptPubKey=%s\n", ScriptToAsmStr(txout.scriptPubKey)); PushStatus(pfrom, STATUS_REJECTED, ERR_NON_STANDARD_PUBKEY, connman); ConsumeCollateral(connman, entry.txCollateral); return; } if (!txout.scriptPubKey.IsPayToPublicKeyHash()) { - LogPrintf("DSVIN -- invalid script! scriptPubKey=%s\n", ScriptToAsmStr(txout.scriptPubKey)); + LogPrint(BCLog::PRIVATESEND, "DSVIN -- invalid script! scriptPubKey=%s\n", ScriptToAsmStr(txout.scriptPubKey)); PushStatus(pfrom, STATUS_REJECTED, ERR_INVALID_SCRIPT, connman); ConsumeCollateral(connman, entry.txCollateral); return; @@ -226,7 +226,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm auto mempoolTx = mempool.get(txin.prevout.hash); if (mempoolTx != nullptr) { if (mempool.isSpent(txin.prevout) || !llmq::quorumInstantSendManager->IsLocked(txin.prevout.hash)) { - LogPrintf("DSVIN -- spent or non-locked mempool input! txin=%s\n", txin.ToString()); + LogPrint(BCLog::PRIVATESEND, "DSVIN -- spent or non-locked mempool input! txin=%s\n", txin.ToString()); PushStatus(pfrom, STATUS_REJECTED, ERR_MISSING_TX, connman); return; } @@ -246,7 +246,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm } nValueIn += coin.out.nValue; } else { - LogPrintf("DSVIN -- missing input! txin=%s\n", txin.ToString()); + LogPrint(BCLog::PRIVATESEND, "DSVIN -- missing input! txin=%s\n", txin.ToString()); PushStatus(pfrom, STATUS_REJECTED, ERR_MISSING_TX, connman); return; } @@ -255,7 +255,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm // There should be no fee in mixing tx CAmount nFee = nValueIn - nValueOut; if (nFee != 0) { - LogPrintf("DSVIN -- there should be no fee in mixing tx! fees: %lld, tx=%s", nFee, tx.ToString()); + LogPrint(BCLog::PRIVATESEND, "DSVIN -- there should be no fee in mixing tx! fees: %lld, tx=%s", nFee, tx.ToString()); PushStatus(pfrom, STATUS_REJECTED, ERR_FEES, connman); return; } @@ -377,7 +377,7 @@ void CPrivateSendServer::CommitFinalTransaction(CConnman& connman) CValidationState validationState; mempool.PrioritiseTransaction(hashTx, 0.1 * COIN); if (!lockMain || !AcceptToMemoryPool(mempool, validationState, finalTransaction, false, nullptr, false, maxTxFee, true)) { - LogPrintf("CPrivateSendServer::CommitFinalTransaction -- AcceptToMemoryPool() error: Transaction not valid\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendServer::CommitFinalTransaction -- AcceptToMemoryPool() error: Transaction not valid\n"); SetNull(); // not much we can do in this case, just notify clients RelayCompletedTransaction(ERR_INVALID_TX, connman); @@ -385,7 +385,7 @@ void CPrivateSendServer::CommitFinalTransaction(CConnman& connman) } } - LogPrintf("CPrivateSendServer::CommitFinalTransaction -- CREATING DSTX\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendServer::CommitFinalTransaction -- CREATING DSTX\n"); // create and sign masternode dstx transaction if (!CPrivateSend::GetDSTX(hashTx)) { @@ -394,7 +394,7 @@ void CPrivateSendServer::CommitFinalTransaction(CConnman& connman) CPrivateSend::AddDSTX(dstxNew); } - LogPrintf("CPrivateSendServer::CommitFinalTransaction -- TRANSMITTING DSTX\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendServer::CommitFinalTransaction -- TRANSMITTING DSTX\n"); CInv inv(MSG_DSTX, hashTx); connman.RelayInv(inv); @@ -443,7 +443,7 @@ void CPrivateSendServer::ChargeFees(CConnman& connman) // This queue entry didn't send us the promised transaction if (!fFound) { - LogPrintf("CPrivateSendServer::ChargeFees -- found uncooperative node (didn't send transaction), found offence\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendServer::ChargeFees -- found uncooperative node (didn't send transaction), found offence\n"); vecOffendersCollaterals.push_back(txCollateral); } } @@ -454,7 +454,7 @@ void CPrivateSendServer::ChargeFees(CConnman& connman) for (const auto& entry : vecEntries) { for (const auto& txdsin : entry.vecTxDSIn) { if (!txdsin.fHasSig) { - LogPrintf("CPrivateSendServer::ChargeFees -- found uncooperative node (didn't sign), found offence\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendServer::ChargeFees -- found uncooperative node (didn't sign), found offence\n"); vecOffendersCollaterals.push_back(entry.txCollateral); } } @@ -474,7 +474,7 @@ void CPrivateSendServer::ChargeFees(CConnman& connman) std::random_shuffle(vecOffendersCollaterals.begin(), vecOffendersCollaterals.end()); if (nState == POOL_STATE_ACCEPTING_ENTRIES || nState == POOL_STATE_SIGNING) { - LogPrintf("CPrivateSendServer::ChargeFees -- found uncooperative node (didn't %s transaction), charging fees: %s", + LogPrint(BCLog::PRIVATESEND, "CPrivateSendServer::ChargeFees -- found uncooperative node (didn't %s transaction), charging fees: %s", (nState == POOL_STATE_SIGNING) ? "sign" : "send", vecOffendersCollaterals[0]->ToString()); ConsumeCollateral(connman, vecOffendersCollaterals[0]); } @@ -498,7 +498,7 @@ void CPrivateSendServer::ChargeRandomFees(CConnman& connman) for (const auto& txCollateral : vecSessionCollaterals) { if (GetRandInt(100) > 10) return; - LogPrintf("CPrivateSendServer::ChargeRandomFees -- charging random fees, txCollateral=%s", txCollateral->ToString()); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendServer::ChargeRandomFees -- charging random fees, txCollateral=%s", txCollateral->ToString()); ConsumeCollateral(connman, txCollateral); } } @@ -699,7 +699,7 @@ bool CPrivateSendServer::AddScriptSig(const CTxIn& txinNew) } } - LogPrintf("CPrivateSendServer::AddScriptSig -- Couldn't set sig!\n"); + LogPrint(BCLog::PRIVATESEND, "CPrivateSendServer::AddScriptSig -- Couldn't set sig!\n"); return false; } @@ -720,7 +720,7 @@ bool CPrivateSendServer::IsOutputsCompatibleWithSessionDenom(const std::vector!") + "

" + tr("Note: You can turn this message off in options."); ui->labelPrivateSendEnabled->setToolTip(strWarn); - LogPrintf("OverviewPage::privateSendStatus -- Very low number of keys left since last automatic backup, warning user and trying to create new backup...\n"); + LogPrint(BCLog::PRIVATESEND, "OverviewPage::privateSendStatus -- Very low number of keys left since last automatic backup, warning user and trying to create new backup...\n"); QMessageBox::warning(this, tr("PrivateSend"), strWarn, QMessageBox::Ok, QMessageBox::Ok); } else { - LogPrintf("OverviewPage::privateSendStatus -- Very low number of keys left since last automatic backup, skipping warning and trying to create new backup...\n"); + LogPrint(BCLog::PRIVATESEND, "OverviewPage::privateSendStatus -- Very low number of keys left since last automatic backup, skipping warning and trying to create new backup...\n"); } std::string strBackupWarning; @@ -518,7 +518,7 @@ void OverviewPage::privateSendStatus() if(!AutoBackupWallet(vpwallets[0], "", strBackupWarning, strBackupError)) { if (!strBackupWarning.empty()) { // It's still more or less safe to continue but warn user anyway - LogPrintf("OverviewPage::privateSendStatus -- WARNING! Something went wrong on automatic backup: %s\n", strBackupWarning); + LogPrint(BCLog::PRIVATESEND, "OverviewPage::privateSendStatus -- WARNING! Something went wrong on automatic backup: %s\n", strBackupWarning); QMessageBox::warning(this, tr("PrivateSend"), tr("WARNING! Something went wrong on automatic backup") + ":

" + strBackupWarning.c_str(), @@ -526,7 +526,7 @@ void OverviewPage::privateSendStatus() } if (!strBackupError.empty()) { // Things are really broken, warn user and stop mixing immediately - LogPrintf("OverviewPage::privateSendStatus -- ERROR! Failed to create automatic backup: %s\n", strBackupError); + LogPrint(BCLog::PRIVATESEND, "OverviewPage::privateSendStatus -- ERROR! Failed to create automatic backup: %s\n", strBackupError); QMessageBox::warning(this, tr("PrivateSend"), tr("ERROR! Failed to create automatic backup") + ":

" + strBackupError.c_str() + "
" + diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 3c48560b02..9f02d4681b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3178,7 +3178,7 @@ bool CWallet::SelectPSInOutPairsByDenominations(int nDenom, CAmount nValueMin, C } AvailableCoins(vCoins, true, nullptr, 1, MAX_MONEY, MAX_MONEY, 0, 0, 9999999, ONLY_DENOMINATED); - LogPrintf("CWallet::%s -- vCoins.size(): %d\n", __func__, vCoins.size()); + LogPrint(BCLog::PRIVATESEND, "CWallet::%s -- vCoins.size(): %d\n", __func__, vCoins.size()); std::random_shuffle(vCoins.rbegin(), vCoins.rend(), GetRandInt); @@ -3205,7 +3205,7 @@ bool CWallet::SelectPSInOutPairsByDenominations(int nDenom, CAmount nValueMin, C } } - LogPrintf("CWallet::%s -- setRecentTxIds.size(): %d\n", __func__, setRecentTxIds.size()); + LogPrint(BCLog::PRIVATESEND, "CWallet::%s -- setRecentTxIds.size(): %d\n", __func__, setRecentTxIds.size()); return nValueTotal >= nValueMin && nDenom == nDenomResult; }