From e544d3c741b79ab72b58f255e352e49a096a746d Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 12 Sep 2024 06:36:41 +0000 Subject: [PATCH] fmt: apply `clang-format-diff.py` suggestions, satisfy linter Co-authored-by: UdjinM6 --- src/coinjoin/client.cpp | 50 ++++++++++++++++++++++-------------- src/coinjoin/server.cpp | 9 ++++--- src/evo/deterministicmns.cpp | 6 ++--- src/evo/dmnstate.cpp | 12 ++++++--- src/evo/providertx.cpp | 15 ++++++++--- src/evo/simplifiedmns.cpp | 8 ++++-- src/masternode/utils.cpp | 3 ++- src/qt/masternodelist.cpp | 3 ++- 8 files changed, 69 insertions(+), 37 deletions(-) diff --git a/src/coinjoin/client.cpp b/src/coinjoin/client.cpp index e41ba135b0..bf8e25ab0b 100644 --- a/src/coinjoin/client.cpp +++ b/src/coinjoin/client.cpp @@ -215,7 +215,8 @@ void CCoinJoinClientSession::ProcessMessage(CNode& peer, CChainState& active_cha } else if (msg_type == NetMsgType::DSCOMPLETE) { if (!mixingMasternode) return; if (mixingMasternode->pdmnState->addr != peer.addr) { - WalletCJLogPrint(m_wallet, "DSCOMPLETE -- message doesn't match current Masternode: infoMixingMasternode=%s addr=%s\n", mixingMasternode->pdmnState->addr.ToStringAddrPort(), peer.addr.ToStringAddrPort()); + WalletCJLogPrint(m_wallet, "DSCOMPLETE -- message doesn't match current Masternode: infoMixingMasternode=%s addr=%s\n", + mixingMasternode->pdmnState->addr.ToStringAddrPort(), peer.addr.ToStringAddrPort()); return; } @@ -1112,7 +1113,9 @@ bool CCoinJoinClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymized, m_clientman.AddUsedMasternode(dsq.masternodeOutpoint); if (connman.IsMasternodeOrDisconnectRequested(dmn->pdmnState->addr)) { - WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::JoinExistingQueue -- skipping masternode connection, addr=%s\n", dmn->pdmnState->addr.ToStringAddrPort()); + WalletCJLogPrint(m_wallet, /* Continued */ + "CCoinJoinClientSession::JoinExistingQueue -- skipping masternode connection, addr=%s\n", + dmn->pdmnState->addr.ToStringAddrPort()); continue; } @@ -1122,8 +1125,11 @@ bool CCoinJoinClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymized, connman.AddPendingMasternode(dmn->proTxHash); SetState(POOL_STATE_QUEUE); nTimeLastSuccessfulStep = GetTime(); - WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::JoinExistingQueue -- pending connection (from queue): nSessionDenom: %d (%s), addr=%s\n", - nSessionDenom, CoinJoin::DenominationToString(nSessionDenom), dmn->pdmnState->addr.ToStringAddrPort()); + WalletCJLogPrint(m_wallet, /* Continued */ + "CCoinJoinClientSession::JoinExistingQueue -- pending connection (from queue): nSessionDenom: " + "%d (%s), addr=%s\n", + nSessionDenom, CoinJoin::DenominationToString(nSessionDenom), + dmn->pdmnState->addr.ToStringAddrPort()); strAutoDenomResult = _("Trying to connect…"); return true; } @@ -1173,21 +1179,24 @@ bool CCoinJoinClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, CCon int64_t nLastDsq = m_mn_metaman.GetMetaInfo(dmn->proTxHash)->GetLastDsq(); int64_t nDsqThreshold = m_mn_metaman.GetDsqThreshold(dmn->proTxHash, nMnCount); if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) { - WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::StartNewQueue -- Too early to mix on this masternode!" /* Continued */ - " masternode=%s addr=%s nLastDsq=%d nDsqThreshold=%d nDsqCount=%d\n", - dmn->proTxHash.ToString(), dmn->pdmnState->addr.ToStringAddrPort(), nLastDsq, - nDsqThreshold, m_mn_metaman.GetDsqCount()); + WalletCJLogPrint(m_wallet, /* Continued */ + "CCoinJoinClientSession::StartNewQueue -- Too early to mix on this masternode!" /* Continued */ + " masternode=%s addr=%s nLastDsq=%d nDsqThreshold=%d nDsqCount=%d\n", + dmn->proTxHash.ToString(), dmn->pdmnState->addr.ToStringAddrPort(), nLastDsq, + nDsqThreshold, m_mn_metaman.GetDsqCount()); nTries++; continue; } if (connman.IsMasternodeOrDisconnectRequested(dmn->pdmnState->addr)) { - WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::StartNewQueue -- skipping masternode connection, addr=%s\n", dmn->pdmnState->addr.ToStringAddrPort()); + WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::StartNewQueue -- skipping masternode connection, addr=%s\n", + dmn->pdmnState->addr.ToStringAddrPort()); nTries++; continue; } - WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::StartNewQueue -- attempt %d connection to Masternode %s\n", nTries, dmn->pdmnState->addr.ToStringAddrPort()); + WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::StartNewQueue -- attempt %d connection to Masternode %s\n", + nTries, dmn->pdmnState->addr.ToStringAddrPort()); // try to get a single random denom out of setAmounts while (nSessionDenom == 0) { @@ -1203,7 +1212,8 @@ bool CCoinJoinClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, CCon pendingDsaRequest = CPendingDsaRequest(dmn->pdmnState->addr, CCoinJoinAccept(nSessionDenom, txMyCollateral)); SetState(POOL_STATE_QUEUE); nTimeLastSuccessfulStep = GetTime(); - WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::StartNewQueue -- pending connection, nSessionDenom: %d (%s), addr=%s\n", + WalletCJLogPrint( /* Continued */ + m_wallet, "CCoinJoinClientSession::StartNewQueue -- pending connection, nSessionDenom: %d (%s), addr=%s\n", nSessionDenom, CoinJoin::DenominationToString(nSessionDenom), dmn->pdmnState->addr.ToStringAddrPort()); strAutoDenomResult = _("Trying to connect…"); return true; @@ -1227,7 +1237,8 @@ bool CCoinJoinClientSession::ProcessPendingDsaRequest(CConnman& connman) if (fDone) { pendingDsaRequest = CPendingDsaRequest(); } else if (pendingDsaRequest.IsExpired()) { - WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- failed to connect to %s\n", __func__, pendingDsaRequest.GetAddr().ToStringAddrPort()); + WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- failed to connect to %s\n", __func__, + pendingDsaRequest.GetAddr().ToStringAddrPort()); WITH_LOCK(cs_coinjoin, SetNull()); } @@ -1824,7 +1835,8 @@ void CCoinJoinClientSession::RelayIn(const CCoinJoinEntry& entry, CConnman& conn if (!mixingMasternode) return; connman.ForNode(mixingMasternode->pdmnState->addr, [&entry, &connman, this](CNode* pnode) { - WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::RelayIn -- found master, relaying message to %s\n", pnode->addr.ToStringAddrPort()); + WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::RelayIn -- found master, relaying message to %s\n", + pnode->addr.ToStringAddrPort()); CNetMsgMaker msgMaker(pnode->GetCommonVersion()); connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSVIN, entry)); return true; @@ -1877,18 +1889,18 @@ void CCoinJoinClientSession::GetJsonInfo(UniValue& obj) const if (mixingMasternode != nullptr) { assert(mixingMasternode->pdmnState); obj.pushKV("protxhash", mixingMasternode->proTxHash.ToString()); - obj.pushKV("outpoint", mixingMasternode->collateralOutpoint.ToStringShort()); - obj.pushKV("service", mixingMasternode->pdmnState->addr.ToStringAddrPort()); + obj.pushKV("outpoint", mixingMasternode->collateralOutpoint.ToStringShort()); + obj.pushKV("service", mixingMasternode->pdmnState->addr.ToStringAddrPort()); } - obj.pushKV("denomination", ValueFromAmount(CoinJoin::DenominationToAmount(nSessionDenom))); - obj.pushKV("state", GetStateString()); + obj.pushKV("denomination", ValueFromAmount(CoinJoin::DenominationToAmount(nSessionDenom))); + obj.pushKV("state", GetStateString()); obj.pushKV("entries_count", GetEntriesCount()); } void CCoinJoinClientManager::GetJsonInfo(UniValue& obj) const { assert(obj.isObject()); - obj.pushKV("running", IsMixing()); + obj.pushKV("running", IsMixing()); UniValue arrSessions(UniValue::VARR); AssertLockNotHeld(cs_deqsessions); @@ -1900,7 +1912,7 @@ void CCoinJoinClientManager::GetJsonInfo(UniValue& obj) const arrSessions.push_back(objSession); } } - obj.pushKV("sessions", arrSessions); + obj.pushKV("sessions", arrSessions); } void CoinJoinWalletManager::Add(CWallet& wallet) diff --git a/src/coinjoin/server.cpp b/src/coinjoin/server.cpp index e87627efa7..0f34255321 100644 --- a/src/coinjoin/server.cpp +++ b/src/coinjoin/server.cpp @@ -86,7 +86,8 @@ void CCoinJoinServer::ProcessDSACCEPT(CNode& peer, CDataStream& vRecv) int64_t nDsqThreshold = m_mn_metaman.GetDsqThreshold(dmn->proTxHash, mnList.GetValidMNsCount()); if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) { if (fLogIPs) { - LogPrint(BCLog::COINJOIN, "DSACCEPT -- last dsq too recent, must wait: peer=%d, addr=%s\n", peer.GetId(), peer.addr.ToStringAddrPort()); + LogPrint(BCLog::COINJOIN, "DSACCEPT -- last dsq too recent, must wait: peer=%d, addr=%s\n", + peer.GetId(), peer.addr.ToStringAddrPort()); } else { LogPrint(BCLog::COINJOIN, "DSACCEPT -- last dsq too recent, must wait: peer=%d\n", peer.GetId()); } @@ -173,12 +174,14 @@ PeerMsgRet CCoinJoinServer::ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv LogPrint(BCLog::COINJOIN, "DSQUEUE -- nLastDsq: %d nDsqThreshold: %d nDsqCount: %d\n", nLastDsq, nDsqThreshold, m_mn_metaman.GetDsqCount()); //don't allow a few nodes to dominate the queuing process if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) { - LogPrint(BCLog::COINJOIN, "DSQUEUE -- Masternode %s is sending too many dsq messages\n", dmn->pdmnState->addr.ToStringAddrPort()); + LogPrint(BCLog::COINJOIN, "DSQUEUE -- Masternode %s is sending too many dsq messages\n", + dmn->pdmnState->addr.ToStringAddrPort()); return {}; } m_mn_metaman.AllowMixing(dmn->proTxHash); - LogPrint(BCLog::COINJOIN, "DSQUEUE -- new CoinJoin queue (%s) from masternode %s\n", dsq.ToString(), dmn->pdmnState->addr.ToStringAddrPort()); + LogPrint(BCLog::COINJOIN, "DSQUEUE -- new CoinJoin queue (%s) from masternode %s\n", dsq.ToString(), + dmn->pdmnState->addr.ToStringAddrPort()); TRY_LOCK(cs_vecqueue, lockRecv); if (!lockRecv) return {}; diff --git a/src/evo/deterministicmns.cpp b/src/evo/deterministicmns.cpp index 115496c08e..158de1ad78 100644 --- a/src/evo/deterministicmns.cpp +++ b/src/evo/deterministicmns.cpp @@ -465,7 +465,7 @@ void CDeterministicMNList::AddMN(const CDeterministicMNCPtr& dmn, bool fBumpTota if (dmn->pdmnState->addr != CService() && !AddUniqueProperty(*dmn, dmn->pdmnState->addr)) { mnUniquePropertyMap = mnUniquePropertyMapSaved; throw(std::runtime_error(strprintf("%s: Can't add a masternode %s with a duplicate address=%s", __func__, - dmn->proTxHash.ToString(), dmn->pdmnState->addr.ToStringAddrPort()))); + dmn->proTxHash.ToString(), dmn->pdmnState->addr.ToStringAddrPort()))); } if (!AddUniqueProperty(*dmn, dmn->pdmnState->keyIDOwner)) { mnUniquePropertyMap = mnUniquePropertyMapSaved; @@ -506,7 +506,7 @@ void CDeterministicMNList::UpdateMN(const CDeterministicMN& oldDmn, const std::s if (!UpdateUniqueProperty(*dmn, oldState->addr, pdmnState->addr)) { mnUniquePropertyMap = mnUniquePropertyMapSaved; throw(std::runtime_error(strprintf("%s: Can't update a masternode %s with a duplicate address=%s", __func__, - oldDmn.proTxHash.ToString(), pdmnState->addr.ToStringAddrPort()))); + oldDmn.proTxHash.ToString(), pdmnState->addr.ToStringAddrPort()))); } if (!UpdateUniqueProperty(*dmn, oldState->keyIDOwner, pdmnState->keyIDOwner)) { mnUniquePropertyMap = mnUniquePropertyMapSaved; @@ -566,7 +566,7 @@ void CDeterministicMNList::RemoveMN(const uint256& proTxHash) if (dmn->pdmnState->addr != CService() && !DeleteUniqueProperty(*dmn, dmn->pdmnState->addr)) { mnUniquePropertyMap = mnUniquePropertyMapSaved; throw(std::runtime_error(strprintf("%s: Can't delete a masternode %s with a address=%s", __func__, - proTxHash.ToString(), dmn->pdmnState->addr.ToStringAddrPort()))); + proTxHash.ToString(), dmn->pdmnState->addr.ToStringAddrPort()))); } if (!DeleteUniqueProperty(*dmn, dmn->pdmnState->keyIDOwner)) { mnUniquePropertyMap = mnUniquePropertyMapSaved; diff --git a/src/evo/dmnstate.cpp b/src/evo/dmnstate.cpp index 6d47d9495e..27f2ae60f0 100644 --- a/src/evo/dmnstate.cpp +++ b/src/evo/dmnstate.cpp @@ -25,10 +25,14 @@ std::string CDeterministicMNState::ToString() const operatorPayoutAddress = EncodeDestination(dest); } - return strprintf("CDeterministicMNState(nVersion=%d, nRegisteredHeight=%d, nLastPaidHeight=%d, nPoSePenalty=%d, nPoSeRevivedHeight=%d, nPoSeBanHeight=%d, nRevocationReason=%d, " - "ownerAddress=%s, pubKeyOperator=%s, votingAddress=%s, addr=%s, payoutAddress=%s, operatorPayoutAddress=%s)", - nVersion, nRegisteredHeight, nLastPaidHeight, nPoSePenalty, nPoSeRevivedHeight, nPoSeBanHeight, nRevocationReason, - EncodeDestination(PKHash(keyIDOwner)), pubKeyOperator.ToString(), EncodeDestination(PKHash(keyIDVoting)), addr.ToStringAddrPort(), payoutAddress, operatorPayoutAddress); + return strprintf("CDeterministicMNState(nVersion=%d, nRegisteredHeight=%d, nLastPaidHeight=%d, nPoSePenalty=%d, " + "nPoSeRevivedHeight=%d, nPoSeBanHeight=%d, nRevocationReason=%d, " + "ownerAddress=%s, pubKeyOperator=%s, votingAddress=%s, addr=%s, payoutAddress=%s, " + "operatorPayoutAddress=%s)", + nVersion, nRegisteredHeight, nLastPaidHeight, nPoSePenalty, nPoSeRevivedHeight, nPoSeBanHeight, + nRevocationReason, EncodeDestination(PKHash(keyIDOwner)), pubKeyOperator.ToString(), + EncodeDestination(PKHash(keyIDVoting)), addr.ToStringAddrPort(), payoutAddress, + operatorPayoutAddress); } UniValue CDeterministicMNState::ToJson(MnType nType) const diff --git a/src/evo/providertx.cpp b/src/evo/providertx.cpp index 5d150346e1..b18d384985 100644 --- a/src/evo/providertx.cpp +++ b/src/evo/providertx.cpp @@ -87,8 +87,13 @@ std::string CProRegTx::ToString() const payee = EncodeDestination(dest); } - return strprintf("CProRegTx(nVersion=%d, nType=%d, collateralOutpoint=%s, addr=%s, nOperatorReward=%f, ownerAddress=%s, pubKeyOperator=%s, votingAddress=%s, scriptPayout=%s, platformNodeID=%s, platformP2PPort=%d, platformHTTPPort=%d)", - nVersion, ToUnderlying(nType), collateralOutpoint.ToStringShort(), addr.ToStringAddrPort(), (double)nOperatorReward / 100, EncodeDestination(PKHash(keyIDOwner)), pubKeyOperator.ToString(), EncodeDestination(PKHash(keyIDVoting)), payee, platformNodeID.ToString(), platformP2PPort, platformHTTPPort); + return strprintf("CProRegTx(nVersion=%d, nType=%d, collateralOutpoint=%s, addr=%s, nOperatorReward=%f, " + "ownerAddress=%s, pubKeyOperator=%s, votingAddress=%s, scriptPayout=%s, platformNodeID=%s, " + "platformP2PPort=%d, platformHTTPPort=%d)", + nVersion, ToUnderlying(nType), collateralOutpoint.ToStringShort(), addr.ToStringAddrPort(), + (double)nOperatorReward / 100, EncodeDestination(PKHash(keyIDOwner)), pubKeyOperator.ToString(), + EncodeDestination(PKHash(keyIDVoting)), payee, platformNodeID.ToString(), platformP2PPort, + platformHTTPPort); } bool CProUpServTx::IsTriviallyValid(bool is_basic_scheme_active, TxValidationState& state) const @@ -111,8 +116,10 @@ std::string CProUpServTx::ToString() const payee = EncodeDestination(dest); } - return strprintf("CProUpServTx(nVersion=%d, nType=%d, proTxHash=%s, addr=%s, operatorPayoutAddress=%s, platformNodeID=%s, platformP2PPort=%d, platformHTTPPort=%d)", - nVersion, ToUnderlying(nType), proTxHash.ToString(), addr.ToStringAddrPort(), payee, platformNodeID.ToString(), platformP2PPort, platformHTTPPort); + return strprintf("CProUpServTx(nVersion=%d, nType=%d, proTxHash=%s, addr=%s, operatorPayoutAddress=%s, " + "platformNodeID=%s, platformP2PPort=%d, platformHTTPPort=%d)", + nVersion, ToUnderlying(nType), proTxHash.ToString(), addr.ToStringAddrPort(), payee, + platformNodeID.ToString(), platformP2PPort, platformHTTPPort); } bool CProUpRegTx::IsTriviallyValid(bool is_basic_scheme_active, TxValidationState& state) const diff --git a/src/evo/simplifiedmns.cpp b/src/evo/simplifiedmns.cpp index b1934b3a20..2946568602 100644 --- a/src/evo/simplifiedmns.cpp +++ b/src/evo/simplifiedmns.cpp @@ -62,8 +62,12 @@ std::string CSimplifiedMNListEntry::ToString() const operatorPayoutAddress = EncodeDestination(dest); } - return strprintf("CSimplifiedMNListEntry(nVersion=%d, nType=%d, proRegTxHash=%s, confirmedHash=%s, service=%s, pubKeyOperator=%s, votingAddress=%s, isValid=%d, payoutAddress=%s, operatorPayoutAddress=%s, platformHTTPPort=%d, platformNodeID=%s)", - nVersion, ToUnderlying(nType), proRegTxHash.ToString(), confirmedHash.ToString(), service.ToStringAddrPort(), pubKeyOperator.ToString(), EncodeDestination(PKHash(keyIDVoting)), isValid, payoutAddress, operatorPayoutAddress, platformHTTPPort, platformNodeID.ToString()); + return strprintf("CSimplifiedMNListEntry(nVersion=%d, nType=%d, proRegTxHash=%s, confirmedHash=%s, service=%s, " + "pubKeyOperator=%s, votingAddress=%s, isValid=%d, payoutAddress=%s, operatorPayoutAddress=%s, " + "platformHTTPPort=%d, platformNodeID=%s)", + nVersion, ToUnderlying(nType), proRegTxHash.ToString(), confirmedHash.ToString(), + service.ToStringAddrPort(), pubKeyOperator.ToString(), EncodeDestination(PKHash(keyIDVoting)), + isValid, payoutAddress, operatorPayoutAddress, platformHTTPPort, platformNodeID.ToString()); } UniValue CSimplifiedMNListEntry::ToJson(bool extended) const diff --git a/src/masternode/utils.cpp b/src/masternode/utils.cpp index 98378f2908..27a5d0d10e 100644 --- a/src/masternode/utils.cpp +++ b/src/masternode/utils.cpp @@ -81,7 +81,8 @@ void CMasternodeUtils::DoMaintenance(CConnman& connman, CDeterministicMNManager& if (fFound) return; // do NOT disconnect mixing masternodes #endif // ENABLE_WALLET if (fLogIPs) { - LogPrint(BCLog::NET_NETCONN, "Closing Masternode connection: peer=%d, addr=%s\n", pnode->GetId(), pnode->addr.ToStringAddrPort()); + LogPrint(BCLog::NET_NETCONN, "Closing Masternode connection: peer=%d, addr=%s\n", pnode->GetId(), + pnode->addr.ToStringAddrPort()); } else { LogPrint(BCLog::NET_NETCONN, "Closing Masternode connection: peer=%d\n", pnode->GetId()); } diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index e2cdcc7df1..36c99c0a29 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -224,7 +224,8 @@ void MasternodeList::updateDIP3List() // Address, Protocol, Status, Active Seconds, Last Seen, Pub Key auto addr_key = dmn.pdmnState->addr.GetKey(); QByteArray addr_ba(reinterpret_cast(addr_key.data()), addr_key.size()); - QTableWidgetItem* addressItem = new CMasternodeListWidgetItem(QString::fromStdString(dmn.pdmnState->addr.ToStringAddrPort()), addr_ba); + QTableWidgetItem* addressItem = new CMasternodeListWidgetItem( + QString::fromStdString(dmn.pdmnState->addr.ToStringAddrPort()), addr_ba); QTableWidgetItem* typeItem = new QTableWidgetItem(QString::fromStdString(std::string(GetMnType(dmn.nType).description))); QTableWidgetItem* statusItem = new QTableWidgetItem(dmn.pdmnState->IsBanned() ? tr("POSE_BANNED") : tr("ENABLED")); QTableWidgetItem* PoSeScoreItem = new CMasternodeListWidgetItem(QString::number(dmn.pdmnState->nPoSePenalty), dmn.pdmnState->nPoSePenalty);