From 8c3ff618d34cabb10ca9150627ac42811b2937c3 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sat, 5 Oct 2024 05:56:50 +0000 Subject: [PATCH] chore: apply some `clang-format-diff.py` suggestions --- src/coinjoin/client.cpp | 6 ++++-- src/coinjoin/client.h | 24 +++++++++++++++++------- src/coinjoin/coinjoin.cpp | 3 ++- src/coinjoin/coinjoin.h | 4 ++-- src/coinjoin/context.cpp | 4 ++-- src/llmq/context.cpp | 35 +++++++++++++++++++---------------- src/rpc/governance.cpp | 2 +- 7 files changed, 47 insertions(+), 31 deletions(-) diff --git a/src/coinjoin/client.cpp b/src/coinjoin/client.cpp index c2ed7c0a20..9739727243 100644 --- a/src/coinjoin/client.cpp +++ b/src/coinjoin/client.cpp @@ -793,7 +793,8 @@ bool CCoinJoinClientManager::CheckAutomaticBackup() // // Passively run mixing in the background to mix funds based on the given configuration. // -bool CCoinJoinClientSession::DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool, bool fDryRun) +bool CCoinJoinClientSession::DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, + const CTxMemPool& mempool, bool fDryRun) { if (m_is_masternode) return false; // no client-side mixing on masternodes if (nState != POOL_STATE_IDLE) return false; @@ -973,7 +974,8 @@ bool CCoinJoinClientSession::DoAutomaticDenominating(ChainstateManager& chainman return false; } -bool CCoinJoinClientManager::DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool, bool fDryRun) +bool CCoinJoinClientManager::DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, + const CTxMemPool& mempool, bool fDryRun) { if (m_is_masternode) return false; // no client-side mixing on masternodes if (!CCoinJoinClientOptions::IsEnabled() || !IsMixing()) return false; diff --git a/src/coinjoin/client.h b/src/coinjoin/client.h index 2002f566d1..a0deebdbd2 100644 --- a/src/coinjoin/client.h +++ b/src/coinjoin/client.h @@ -75,10 +75,17 @@ public: using wallet_name_cjman_map = std::map>; public: - CoinJoinWalletManager(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, const CTxMemPool& mempool, - const CMasternodeSync& mn_sync, const std::unique_ptr& queueman, bool is_masternode) - : m_chainman(chainman), m_connman(connman), m_dmnman(dmnman), m_mn_metaman(mn_metaman), m_mempool(mempool), m_mn_sync(mn_sync), - m_queueman(queueman), m_is_masternode{is_masternode} + CoinJoinWalletManager(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman, + CMasternodeMetaMan& mn_metaman, const CTxMemPool& mempool, const CMasternodeSync& mn_sync, + const std::unique_ptr& queueman, bool is_masternode) : + m_chainman(chainman), + m_connman(connman), + m_dmnman(dmnman), + m_mn_metaman(mn_metaman), + m_mempool(mempool), + m_mn_sync(mn_sync), + m_queueman(queueman), + m_is_masternode{is_masternode} {} ~CoinJoinWalletManager() { @@ -203,7 +210,8 @@ public: bool GetMixingMasternodeInfo(CDeterministicMNCPtr& ret) const; /// Passively run mixing in the background according to the configuration in settings - bool DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool, bool fDryRun = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); + bool DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool, + bool fDryRun = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); /// As a client, submit part of a future mixing transaction to a Masternode to start the process bool SubmitDenominate(CConnman& connman); @@ -311,7 +319,8 @@ public: bool GetMixingMasternodesInfo(std::vector& vecDmnsRet) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); /// Passively run mixing in the background according to the configuration in settings - bool DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool, bool fDryRun = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); + bool DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool, + bool fDryRun = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); bool TrySubmitDenominate(const CService& mnAddr, CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); bool MarkAlreadyJoinedQueueAsTried(CCoinJoinQueue& dsq) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); @@ -327,7 +336,8 @@ public: void UpdatedBlockTip(const CBlockIndex* pindex); - void DoMaintenance(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); + void DoMaintenance(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool) + EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); void GetJsonInfo(UniValue& obj) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); }; diff --git a/src/coinjoin/coinjoin.cpp b/src/coinjoin/coinjoin.cpp index bc6a65e994..338b4cf054 100644 --- a/src/coinjoin/coinjoin.cpp +++ b/src/coinjoin/coinjoin.cpp @@ -308,7 +308,8 @@ bool CCoinJoinBaseSession::IsValidInOuts(CChainState& active_chainstate, const C // Responsibility for checking fee sanity is moved from the mempool to the client (BroadcastTransaction) // but CoinJoin still requires ATMP with fee sanity checks so we need to implement them separately -bool ATMPIfSaneFee(ChainstateManager& chainman, const CTransactionRef &tx, bool test_accept) { +bool ATMPIfSaneFee(ChainstateManager& chainman, const CTransactionRef& tx, bool test_accept) +{ AssertLockHeld(cs_main); const MempoolAcceptResult result = chainman.ProcessTransaction(tx, /*test_accept=*/true); diff --git a/src/coinjoin/coinjoin.h b/src/coinjoin/coinjoin.h index 1e36f24207..6bf8e93e11 100644 --- a/src/coinjoin/coinjoin.h +++ b/src/coinjoin/coinjoin.h @@ -370,7 +370,6 @@ namespace CoinJoin /// If the collateral is valid given by a client bool IsCollateralValid(ChainstateManager& chainman, const CTxMemPool& mempool, const CTransaction& txCollateral); - } class CDSTXManager @@ -403,6 +402,7 @@ private: }; -bool ATMPIfSaneFee(ChainstateManager& chainman, const CTransactionRef &tx, bool test_accept = false) EXCLUSIVE_LOCKS_REQUIRED(cs_main); +bool ATMPIfSaneFee(ChainstateManager& chainman, const CTransactionRef& tx, bool test_accept = false) + EXCLUSIVE_LOCKS_REQUIRED(cs_main); #endif // BITCOIN_COINJOIN_COINJOIN_H diff --git a/src/coinjoin/context.cpp b/src/coinjoin/context.cpp index c4aa025804..8ce72e3b97 100644 --- a/src/coinjoin/context.cpp +++ b/src/coinjoin/context.cpp @@ -15,8 +15,8 @@ CJContext::CJContext(ChainstateManager& chainman, CConnman& connman, CDeterminis std::unique_ptr& peerman, bool relay_txes) : dstxman{std::make_unique()}, #ifdef ENABLE_WALLET - walletman{std::make_unique(chainman, connman, dmnman, mn_metaman, mempool, mn_sync, - queueman, /* is_masternode = */ mn_activeman != nullptr)}, + walletman{std::make_unique(chainman, connman, dmnman, mn_metaman, mempool, mn_sync, queueman, + /* is_masternode = */ mn_activeman != nullptr)}, queueman{relay_txes ? std::make_unique(connman, peerman, *walletman, dmnman, mn_metaman, mn_sync, /* is_masternode = */ mn_activeman != nullptr) diff --git a/src/llmq/context.cpp b/src/llmq/context.cpp index 30e3d45187..94da64087c 100644 --- a/src/llmq/context.cpp +++ b/src/llmq/context.cpp @@ -18,8 +18,8 @@ #include #include -LLMQContext::LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman, CEvoDB& evo_db, - CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman, +LLMQContext::LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman, + CEvoDB& evo_db, CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman, CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync, const std::unique_ptr& peerman, bool unit_tests, bool wipe) : @@ -27,29 +27,32 @@ LLMQContext::LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterm bls_worker{std::make_shared()}, dkg_debugman{std::make_unique()}, quorum_block_processor{std::make_unique(chainman.ActiveChainstate(), dmnman, evo_db)}, - qdkgsman{std::make_unique(*bls_worker, chainman.ActiveChainstate(), connman, dmnman, *dkg_debugman, - mn_metaman, *quorum_block_processor, mn_activeman, sporkman, - peerman, unit_tests, wipe)}, - qman{std::make_unique(*bls_worker, chainman.ActiveChainstate(), connman, dmnman, *qdkgsman, evo_db, - *quorum_block_processor, mn_activeman, mn_sync, sporkman, unit_tests, - wipe)}, - sigman{std::make_unique(connman, mn_activeman, chainman.ActiveChainstate(), *qman, peerman, unit_tests, wipe)}, + qdkgsman{std::make_unique(*bls_worker, chainman.ActiveChainstate(), connman, dmnman, + *dkg_debugman, mn_metaman, *quorum_block_processor, + mn_activeman, sporkman, peerman, unit_tests, wipe)}, + qman{std::make_unique(*bls_worker, chainman.ActiveChainstate(), connman, dmnman, *qdkgsman, + evo_db, *quorum_block_processor, mn_activeman, mn_sync, sporkman, + unit_tests, wipe)}, + sigman{std::make_unique(connman, mn_activeman, chainman.ActiveChainstate(), *qman, peerman, + unit_tests, wipe)}, shareman{std::make_unique(connman, *sigman, mn_activeman, *qman, sporkman, peerman)}, clhandler{[&]() -> llmq::CChainLocksHandler* const { assert(llmq::chainLocksHandler == nullptr); - llmq::chainLocksHandler = std::make_unique(chainman.ActiveChainstate(), *qman, *sigman, *shareman, - sporkman, mempool, mn_sync, is_masternode); + llmq::chainLocksHandler = std::make_unique(chainman.ActiveChainstate(), *qman, + *sigman, *shareman, sporkman, mempool, + mn_sync, is_masternode); return llmq::chainLocksHandler.get(); }()}, isman{[&]() -> llmq::CInstantSendManager* const { assert(llmq::quorumInstantSendManager == nullptr); - llmq::quorumInstantSendManager = std::make_unique( - *llmq::chainLocksHandler, chainman.ActiveChainstate(), connman, *qman, *sigman, *shareman, sporkman, - mempool, mn_sync, peerman, is_masternode, unit_tests, wipe); + llmq::quorumInstantSendManager = std::make_unique(*llmq::chainLocksHandler, + chainman.ActiveChainstate(), + connman, *qman, *sigman, *shareman, + sporkman, mempool, mn_sync, peerman, + is_masternode, unit_tests, wipe); return llmq::quorumInstantSendManager.get(); }()}, - ehfSignalsHandler{ - std::make_unique(chainman, mnhfman, *sigman, *shareman, *qman)} + ehfSignalsHandler{std::make_unique(chainman, mnhfman, *sigman, *shareman, *qman)} { } diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index 68290a6aa5..da77453744 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -14,8 +14,8 @@ #include #include #include -#include #include +#include #include #include #include