diff --git a/src/bench/string_cast.cpp b/src/bench/string_cast.cpp index e08356433a..655a63a598 100644 --- a/src/bench/string_cast.cpp +++ b/src/bench/string_cast.cpp @@ -18,8 +18,9 @@ std::string NumberToString(T Number){ static void int_atoi(benchmark::Bench& bench) { + int value; bench.run([&] { - atoi("1"); + value = atoi("1"); }); } diff --git a/src/bls/bls_worker.cpp b/src/bls/bls_worker.cpp index a0b73606fc..9ddaa1c7a8 100644 --- a/src/bls/bls_worker.cpp +++ b/src/bls/bls_worker.cpp @@ -154,8 +154,8 @@ struct Aggregator : public std::enable_shared_from_this> { bool _parallel, ctpl::thread_pool& _workerPool, DoneCallback _doneCallback) : - workerPool(_workerPool), parallel(_parallel), + workerPool(_workerPool), doneCallback(std::move(_doneCallback)) { inputVec = std::make_shared >(count); @@ -342,7 +342,7 @@ struct VectorAggregator : public std::enable_shared_from_this doneCount; + std::atomic doneCount{0}; VectorPtrType result; size_t vecSize; @@ -351,13 +351,12 @@ struct VectorAggregator : public std::enable_shared_from_thissize(); @@ -417,7 +416,7 @@ struct ContributionVerifier : public std::enable_shared_from_this batchStates; @@ -435,9 +434,8 @@ struct ContributionVerifier : public std::enable_shared_from_this::max()}; // used for the overview screen + bool fCreateAutoBackups{true}; // builtin support for automatic backups CCoinJoinClientManager() = delete; CCoinJoinClientManager(CCoinJoinClientManager const&) = delete; CCoinJoinClientManager& operator=(CCoinJoinClientManager const&) = delete; explicit CCoinJoinClientManager(CWallet& wallet) : - vecMasternodesUsed(), - deqSessions(), - nCachedLastSuccessBlock(0), - nMinBlocksToWait(1), - strAutoDenomResult(), - nCachedBlockHeight(0), - nCachedNumBlocks(std::numeric_limits::max()), - fCreateAutoBackups(true), - mixingWallet(wallet) - { - } + mixingWallet(wallet) {} void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman, bool enable_bip61); diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 896ddf707a..bb49f9bf73 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -188,7 +188,6 @@ public: class WalletImpl : public Wallet { public: - CoinJoinImpl m_coinjoin; explicit WalletImpl(const std::shared_ptr& wallet) : m_wallet(wallet), m_coinjoin(wallet) {} @@ -592,6 +591,7 @@ public: } std::shared_ptr m_wallet; + CoinJoinImpl m_coinjoin; }; class WalletClientImpl : public ChainClient diff --git a/src/llmq/dkgsessionhandler.cpp b/src/llmq/dkgsessionhandler.cpp index 82b7ea48a6..d0af4e6225 100644 --- a/src/llmq/dkgsessionhandler.cpp +++ b/src/llmq/dkgsessionhandler.cpp @@ -21,8 +21,8 @@ namespace llmq { CDKGPendingMessages::CDKGPendingMessages(size_t _maxMessagesPerNode, int _invType) : - maxMessagesPerNode(_maxMessagesPerNode), - invType(_invType) + invType(_invType), + maxMessagesPerNode(_maxMessagesPerNode) { } diff --git a/src/qt/appearancewidget.cpp b/src/qt/appearancewidget.cpp index 25d6ade491..e74e91ba1b 100644 --- a/src/qt/appearancewidget.cpp +++ b/src/qt/appearancewidget.cpp @@ -20,13 +20,7 @@ AppearanceWidget::AppearanceWidget(QWidget* parent) : QWidget(parent), - ui(new Ui::AppearanceWidget), - fAcceptChanges(false), - prevTheme(GUIUtil::getActiveTheme()), - prevFontFamily(GUIUtil::getFontFamily()), - prevScale(GUIUtil::getFontScale()), - prevWeightNormal(GUIUtil::getFontWeightNormal()), - prevWeightBold(GUIUtil::getFontWeightBold()) + ui{new Ui::AppearanceWidget()} { ui->setupUi(this); diff --git a/src/qt/appearancewidget.h b/src/qt/appearancewidget.h index 632750d472..2aea003d6f 100644 --- a/src/qt/appearancewidget.h +++ b/src/qt/appearancewidget.h @@ -46,12 +46,12 @@ private: Ui::AppearanceWidget* ui; QDataWidgetMapper* mapper; OptionsModel* model; - bool fAcceptChanges; - QString prevTheme; - int prevScale; - GUIUtil::FontFamily prevFontFamily; - QFont::Weight prevWeightNormal; - QFont::Weight prevWeightBold; + bool fAcceptChanges{false}; + QString prevTheme{GUIUtil::getActiveTheme()}; + int prevScale{GUIUtil::getFontScale()}; + GUIUtil::FontFamily prevFontFamily{GUIUtil::getFontFamily()}; + QFont::Weight prevWeightNormal{GUIUtil::getFontWeightNormal()}; + QFont::Weight prevWeightBold{GUIUtil::getFontWeightBold()}; void updateWeightSlider(bool fForce = false); }; diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index e898faedcc..14c7c86c9c 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -81,8 +81,8 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM = BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle, QWidget* parent) : QMainWindow(parent), m_node(node), - m_network_style(networkStyle), - trayIconMenu{new QMenu()} + trayIconMenu{new QMenu()}, + m_network_style(networkStyle) { GUIUtil::loadTheme(true); diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index b0cb336127..824f328fac 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -44,13 +44,7 @@ public: MasternodeList::MasternodeList(QWidget* parent) : QWidget(parent), - ui(new Ui::MasternodeList), - clientModel(0), - walletModel(0), - fFilterUpdatedDIP3(true), - nTimeFilterUpdatedDIP3(0), - nTimeUpdatedDIP3(0), - mnListChanged(true) + ui(new Ui::MasternodeList) { ui->setupUi(this); diff --git a/src/qt/masternodelist.h b/src/qt/masternodelist.h index 40203d2de4..acfd100742 100644 --- a/src/qt/masternodelist.h +++ b/src/qt/masternodelist.h @@ -56,21 +56,21 @@ public: private: QMenu* contextMenuDIP3; - int64_t nTimeFilterUpdatedDIP3; - int64_t nTimeUpdatedDIP3; - bool fFilterUpdatedDIP3; + int64_t nTimeFilterUpdatedDIP3{0}; + int64_t nTimeUpdatedDIP3{0}; + bool fFilterUpdatedDIP3{true}; QTimer* timer; Ui::MasternodeList* ui; - ClientModel* clientModel; - WalletModel* walletModel; + ClientModel* clientModel{nullptr}; + WalletModel* walletModel{nullptr}; // Protects tableWidgetMasternodesDIP3 CCriticalSection cs_dip3list; QString strCurrentFilterDIP3; - bool mnListChanged; + bool mnListChanged{true}; CDeterministicMNCPtr GetSelectedDIP3MN(); diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index dc9031bbbb..ac1b298a65 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -196,11 +196,11 @@ bool PaymentServer::ipcSendCommandLine() PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : QObject(parent), - saveURIs(true), - uriServer(nullptr), #ifdef ENABLE_BIP70 netManager(nullptr), #endif + saveURIs(true), + uriServer(nullptr), optionsModel(nullptr) { #ifdef ENABLE_BIP70 diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h index cb66d15229..862d132a3d 100644 --- a/src/qt/paymentserver.h +++ b/src/qt/paymentserver.h @@ -142,10 +142,6 @@ protected: bool eventFilter(QObject *object, QEvent *event) override; private: - bool saveURIs; // true during startup - QLocalServer* uriServer; - OptionsModel *optionsModel; - #ifdef ENABLE_BIP70 static bool readPaymentRequestFromFile(const QString& filename, PaymentRequestPlus& request); bool processPaymentRequest(const PaymentRequestPlus& request, SendCoinsRecipient& recipient); @@ -155,6 +151,10 @@ private: void initNetManager(); QNetworkAccessManager* netManager; // Used to fetch payment requests #endif + + bool saveURIs; // true during startup + QLocalServer* uriServer; + OptionsModel *optionsModel; }; #endif // BITCOIN_QT_PAYMENTSERVER_H diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 9d7f9f765c..602f0b754a 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -439,7 +439,7 @@ static UniValue masternode_payments(const JSONRPCRequest& request) // A temporary vector which is used to sort results properly (there is no "reverse" in/for UniValue) std::vector vecPayments; - while (vecPayments.size() < std::abs(nCount) != 0 && pindex != nullptr) { + while (vecPayments.size() < std::abs(nCount) && pindex != nullptr) { CBlock block; if (!ReadBlockFromDisk(block, pindex, Params().GetConsensus())) { diff --git a/src/test/cachemultimap_tests.cpp b/src/test/cachemultimap_tests.cpp index 0deffa04ab..1fa2cd0e13 100644 --- a/src/test/cachemultimap_tests.cpp +++ b/src/test/cachemultimap_tests.cpp @@ -11,15 +11,6 @@ BOOST_FIXTURE_TEST_SUITE(cachemultimap_tests, BasicTestingSetup) -static void DumpMap(const CacheMultiMap& cmmap) -{ - const CacheMultiMap::list_t& listItems = cmmap.GetItemList(); - for(CacheMultiMap::list_cit it = listItems.begin(); it != listItems.end(); ++it) { - const CacheItem& item = *it; - std::cout << item.key << " : " << item.value << std::endl; - } -} - static bool Compare(const CacheMultiMap& cmmap1, const CacheMultiMap& cmmap2) { if(cmmap1.GetMaxSize() != cmmap2.GetMaxSize()) { diff --git a/src/validation.cpp b/src/validation.cpp index 31c06e0359..021323b17d 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -162,8 +162,6 @@ CBlockPolicyEstimator feeEstimator; CTxMemPool mempool(&feeEstimator); std::atomic_bool g_is_mempool_loaded{false}; -static void CheckBlockIndex(const Consensus::Params& consensusParams); - // Internal stuff namespace { CBlockIndex* pindexBestInvalid = nullptr; diff --git a/src/validation.h b/src/validation.h index 025e54f66c..949b07c953 100644 --- a/src/validation.h +++ b/src/validation.h @@ -263,9 +263,6 @@ void PruneBlockFilesManual(int nManualPruneHeight); bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx, bool* pfMissingInputs, bool bypass_limits, const CAmount nAbsurdFee, bool test_accept=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main); -static bool AcceptToMemoryPoolWithTime(const CChainParams& chainparams, CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx, - bool* pfMissingInputs, int64_t nAcceptTime, bool bypass_limits, - const CAmount nAbsurdFee, bool test_accept = false); bool GetUTXOCoin(const COutPoint& outpoint, Coin& coin); int GetUTXOHeight(const COutPoint& outpoint);