From c9cb9a680abd41c40d86d3b4883108148c44164f Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 5 Jul 2018 23:43:54 -0400 Subject: [PATCH 01/12] merge bitcoin#13633: Drop dead code from Stacks --- src/script/sign.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/script/sign.cpp b/src/script/sign.cpp index c7421b61c259..fb61a4fe559f 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -239,17 +239,11 @@ struct Stacks { std::vector script; - Stacks() {} - explicit Stacks(const std::vector& scriptSigStack_) : script(scriptSigStack_) {} + Stacks() = delete; + Stacks(const Stacks&) = delete; explicit Stacks(const SignatureData& data) { EvalScript(script, data.scriptSig, SCRIPT_VERIFY_STRICTENC, BaseSignatureChecker(), SigVersion::BASE); } - - SignatureData Output() const { - SignatureData result; - result.scriptSig = PushAll(script); - return result; - } }; } From df9c9268d09596a058587d9e42ad74dd40c76864 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Apr 2025 15:33:36 +0000 Subject: [PATCH 02/12] chore: drop unused `EraseOldDBData()` --- src/evo/deterministicmns.cpp | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/evo/deterministicmns.cpp b/src/evo/deterministicmns.cpp index 5d94bb378c6a..008dcaeb7ba2 100644 --- a/src/evo/deterministicmns.cpp +++ b/src/evo/deterministicmns.cpp @@ -1187,32 +1187,6 @@ void CDeterministicMNManager::CleanupCache(int nHeight) } -[[nodiscard]] static bool EraseOldDBData(CDBWrapper& db, const std::vector& db_key_prefixes) -{ - bool erased{false}; - for(const auto& db_key_prefix : db_key_prefixes) { - CDBBatch batch{db}; - std::unique_ptr it{db.NewIterator()}; - std::pair firstKey{db_key_prefix, uint256()}; - it->Seek(firstKey); - while (it->Valid()) { - decltype(firstKey) curKey; - if (!it->GetKey(curKey) || std::get<0>(curKey) != db_key_prefix) { - break; - } - batch.Erase(curKey); - erased = true; - it->Next(); - } - if (erased) { - LogPrintf("CDeterministicMNManager::%s -- updating db...\n", __func__); - db.WriteBatch(batch); - LogPrintf("CDeterministicMNManager::%s -- done cleaning old data for %s\n", __func__, db_key_prefix); - } - } - return erased; -} - template static bool CheckService(const ProTx& proTx, TxValidationState& state) { From f6d1eb9d38c94047a2c41aba7e48f3f7204a6d7f Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Apr 2025 16:14:44 +0000 Subject: [PATCH 03/12] chore: drop extraneous unused `ApplyStats()` definition --- src/node/coinstats.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/node/coinstats.cpp b/src/node/coinstats.cpp index 1984d0bd356b..cd8748d17009 100644 --- a/src/node/coinstats.cpp +++ b/src/node/coinstats.cpp @@ -91,19 +91,6 @@ static void ApplyStats(CCoinsStats& stats, const uint256& hash, const std::map& outputs) -{ - assert(!outputs.empty()); - stats.nTransactions++; - for (const auto& output : outputs) { - stats.nTransactionOutputs++; - if (stats.total_amount.has_value()) { - stats.total_amount = CheckedAdd(*stats.total_amount, output.second.out.nValue); - } - stats.nBogoSize += GetBogoSize(output.second.out.scriptPubKey); - } -} - //! Calculate statistics about the unspent transaction output set template static bool GetUTXOStats(CCoinsView* view, BlockManager& blockman, CCoinsStats& stats, T hash_obj, const std::function& interruption_point, const CBlockIndex* pindex) From 6729d69e931c8cb73baf4be58411dedba76d531b Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Apr 2025 12:29:09 +0000 Subject: [PATCH 04/12] fix: add missing lock annotation in lambda expression Also, add `AssertLockHeld` to corresponding `EXCLUSIVE_LOCKS_REQUIRED` --- src/wallet/rpcwallet.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index cbf40483bd22..d8875f56730c 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -952,6 +952,8 @@ struct tallyitem static UniValue ListReceived(const CWallet& wallet, const UniValue& params, const bool by_label, const bool include_immature_coinbase) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet) { + AssertLockHeld(wallet.cs_wallet); + // Minimum confirmations int nMinDepth = 1; if (!params[0].isNull()) @@ -1029,7 +1031,11 @@ static UniValue ListReceived(const CWallet& wallet, const UniValue& params, cons UniValue ret(UniValue::VARR); std::map label_tally; - const auto& func = [&](const CTxDestination& address, const std::string& label, const std::string& purpose, bool is_change) { + const auto& func = [&](const CTxDestination& address, const std::string& label, const std::string& purpose, bool is_change) + EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet) + { + AssertLockHeld(wallet.cs_wallet); + if (is_change) return; // no change addresses auto it = mapTally.find(address); if (it == mapTally.end() && !fIncludeEmpty) From 9315e69905e01d3d9443786bb9580fabb72cd862 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Apr 2025 20:20:17 +0000 Subject: [PATCH 05/12] move-only: keep functions used in wallet-enabled segments within macro Required to avoid `-Wunused-function` warnings when building with wallet support disabled. --- src/rpc/evo.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index 217c0f39a6c0..9e877daf66ba 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -180,6 +180,19 @@ static RPCArg GetRpcArg(const std::string& strParamName) return it->second; } +static CBLSSecretKey ParseBLSSecretKey(const std::string& hexKey, const std::string& paramName) +{ + CBLSSecretKey secKey; + + // Actually, bool flag for bls::PrivateKey has other meaning (modOrder) + if (!secKey.SetHexStr(hexKey, false)) { + throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be a valid BLS secret key", paramName)); + } + return secKey; +} + +#ifdef ENABLE_WALLET + static CKeyID ParsePubKeyIDFromAddress(const std::string& strAddress, const std::string& paramName) { CTxDestination dest = DecodeDestination(strAddress); @@ -199,24 +212,11 @@ static CBLSPublicKey ParseBLSPubKey(const std::string& hexKey, const std::string return pubKey; } -static CBLSSecretKey ParseBLSSecretKey(const std::string& hexKey, const std::string& paramName) -{ - CBLSSecretKey secKey; - - // Actually, bool flag for bls::PrivateKey has other meaning (modOrder) - if (!secKey.SetHexStr(hexKey, false)) { - throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be a valid BLS secret key", paramName)); - } - return secKey; -} - static bool ValidatePlatformPort(const int32_t port) { return port >= 1 && port <= std::numeric_limits::max(); } -#ifdef ENABLE_WALLET - template static void FundSpecialTx(CWallet& wallet, CMutableTransaction& tx, const SpecialTxPayload& payload, const CTxDestination& fundDest) EXCLUSIVE_LOCKS_REQUIRED(!wallet.cs_wallet) From 53d29e9993c3dc439023c95ef0f2e727f4e70118 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Apr 2025 16:32:17 +0000 Subject: [PATCH 06/12] fix: sidestep `-Wunused-function` warnings with `[[maybe_unused]]` Code is unused but inherited by upstream and therefore, has to stick around even if we do nothing with it. --- src/script/bitcoinconsensus.cpp | 2 +- src/script/interpreter.cpp | 2 +- src/test/script_tests.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/script/bitcoinconsensus.cpp b/src/script/bitcoinconsensus.cpp index a7bb81bbee3a..8f979a0c26b0 100644 --- a/src/script/bitcoinconsensus.cpp +++ b/src/script/bitcoinconsensus.cpp @@ -48,7 +48,7 @@ class TxInputStream return *this; } - int GetVersion() const { return m_version; } + [[maybe_unused]] int GetVersion() const { return m_version; } private: const int m_version; const unsigned char* m_data; diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index b9b10fa19e20..baefdd92cb81 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1521,7 +1521,7 @@ template void PrecomputedTransactionData::Init(const CMutableTransaction& txTo, template PrecomputedTransactionData::PrecomputedTransactionData(const CTransaction& txTo); template PrecomputedTransactionData::PrecomputedTransactionData(const CMutableTransaction& txTo); -static bool HandleMissingData(MissingDataBehavior mdb) +[[maybe_unused]] static bool HandleMissingData(MissingDataBehavior mdb) { switch (mdb) { case MissingDataBehavior::ASSERT_FAIL: diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index 9281003ff860..5d79aac696f7 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -282,19 +282,19 @@ class TestBuilder return *this; } - TestBuilder& Push(const std::string& hex) + [[maybe_unused]] TestBuilder& Push(const std::string& hex) { DoPush(ParseHex(hex)); return *this; } - TestBuilder& Push(const uint256& hash) + [[maybe_unused]] TestBuilder& Push(const uint256& hash) { DoPush(ToByteVector(hash)); return *this; } - TestBuilder& Push(const CScript& script) + [[maybe_unused]] TestBuilder& Push(const CScript& script) { DoPush(std::vector(script.begin(), script.end())); return *this; From 184b463ec7d2a8d710d6829326ea000534093cdf Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Apr 2025 14:19:57 +0000 Subject: [PATCH 07/12] fix: resolve `-Wdelete-non-abstract-non-virtual-dtor` warnings --- src/coinjoin/coinjoin.h | 1 + src/versionbits.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/coinjoin/coinjoin.h b/src/coinjoin/coinjoin.h index 69b7dd75e7b1..f9cd1de64bc8 100644 --- a/src/coinjoin/coinjoin.h +++ b/src/coinjoin/coinjoin.h @@ -317,6 +317,7 @@ class CCoinJoinBaseSession int nSessionDenom{0}; // Users must submit a denom matching this CCoinJoinBaseSession() = default; + virtual ~CCoinJoinBaseSession() = default; int GetState() const { return nState; } std::string GetStateString() const; diff --git a/src/versionbits.h b/src/versionbits.h index 55332c3542df..19232ba61977 100644 --- a/src/versionbits.h +++ b/src/versionbits.h @@ -107,13 +107,16 @@ class AbstractEHFManager public: using Signals = std::unordered_map; +public: + AbstractEHFManager() = default; + virtual ~AbstractEHFManager() = default; + /** * getInstance() is used in versionbit because it is non-trivial * to get access to NodeContext from all usages of VersionBits* methods * For simplification of interface this methods static/global variable is used * to get access to EHF data */ -public: [[nodiscard]] static gsl::not_null getInstance() { return globalInstance; }; @@ -127,7 +130,6 @@ class AbstractEHFManager */ virtual Signals GetSignalsStage(const CBlockIndex* const pindexPrev) = 0; - protected: static AbstractEHFManager* globalInstance; }; From 7a5208313543f9c617b2318a1d7248be9d0b70aa Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Apr 2025 14:35:34 +0000 Subject: [PATCH 08/12] fix: resolve `-Wmissing-field-initializers` warnings --- src/qt/networkstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index 7bc909f2cce0..6abda8602e29 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -24,9 +24,9 @@ static const struct { const std::string titleAddText; } network_styles[] = { {"main", QAPP_APP_NAME_DEFAULT, 0, 0, ""}, - {"test", QAPP_APP_NAME_TESTNET, 190, 20}, + {"test", QAPP_APP_NAME_TESTNET, 190, 20, ""}, {"devnet", QAPP_APP_NAME_DEVNET, 190, 20, "[devnet: %s]"}, - {"regtest", QAPP_APP_NAME_REGTEST, 160, 30} + {"regtest", QAPP_APP_NAME_REGTEST, 160, 30, ""} }; void NetworkStyle::rotateColor(QColor& col, const int iconColorHueShift, const int iconColorSaturationReduction) From 7459b1e0948597f96a1f130a949efbce196282aa Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 22 Apr 2025 15:51:05 +0000 Subject: [PATCH 09/12] fix: resolve `-Wunused-private-field` warnings --- src/coinjoin/client.cpp | 18 +++++++----------- src/coinjoin/client.h | 16 ++++++---------- src/evo/creditpool.cpp | 6 +++--- src/evo/creditpool.h | 2 +- src/evo/deterministicmns.h | 4 +--- src/node/chainstate.cpp | 2 +- src/wallet/hdchain.h | 2 +- 7 files changed, 20 insertions(+), 30 deletions(-) diff --git a/src/coinjoin/client.cpp b/src/coinjoin/client.cpp index e83954dc9f33..7e2747c91a6b 100644 --- a/src/coinjoin/client.cpp +++ b/src/coinjoin/client.cpp @@ -105,7 +105,7 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnm // if the queue is ready, submit if we can if (dsq.fReady && - m_walletman.ForAnyCJClientMan([this, &connman, &dmn](std::unique_ptr& clientman) { + m_walletman.ForAnyCJClientMan([&connman, &dmn](std::unique_ptr& clientman) { return clientman->TrySubmitDenominate(dmn->proTxHash, connman); })) { LogPrint(BCLog::COINJOIN, "DSQUEUE -- CoinJoin queue is ready, masternode=%s, queue=%s\n", dmn->proTxHash.ToString(), dsq.ToString()); @@ -161,14 +161,12 @@ void CCoinJoinClientManager::ProcessMessage(CNode& peer, CChainState& active_cha } } -CCoinJoinClientSession::CCoinJoinClientSession(const std::shared_ptr& wallet, CoinJoinWalletManager& walletman, - CCoinJoinClientManager& clientman, CDeterministicMNManager& dmnman, - CMasternodeMetaMan& mn_metaman, const CMasternodeSync& mn_sync, - const llmq::CInstantSendManager& isman, +CCoinJoinClientSession::CCoinJoinClientSession(const std::shared_ptr& wallet, CCoinJoinClientManager& clientman, + CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, + const CMasternodeSync& mn_sync, const llmq::CInstantSendManager& isman, const std::unique_ptr& queueman, bool is_masternode) : m_wallet(wallet), - m_walletman(walletman), m_clientman(clientman), m_dmnman(dmnman), m_mn_metaman(mn_metaman), @@ -998,8 +996,7 @@ bool CCoinJoinClientManager::DoAutomaticDenominating(ChainstateManager& chainman AssertLockNotHeld(cs_deqsessions); LOCK(cs_deqsessions); if (int(deqSessions.size()) < CCoinJoinClientOptions::GetSessions()) { - deqSessions.emplace_back(m_wallet, m_walletman, *this, m_dmnman, m_mn_metaman, m_mn_sync, m_isman, m_queueman, - m_is_masternode); + deqSessions.emplace_back(m_wallet, *this, m_dmnman, m_mn_metaman, m_mn_sync, m_isman, m_queueman, m_is_masternode); } for (auto& session : deqSessions) { if (!CheckAutomaticBackup()) return false; @@ -1905,9 +1902,8 @@ void CoinJoinWalletManager::Add(const std::shared_ptr& wallet) { LOCK(cs_wallet_manager_map); m_wallet_manager_map.try_emplace(wallet->GetName(), - std::make_unique(wallet, *this, m_dmnman, m_mn_metaman, - m_mn_sync, m_isman, m_queueman, - m_is_masternode)); + std::make_unique(wallet, m_dmnman, m_mn_metaman, m_mn_sync, + m_isman, m_queueman, m_is_masternode)); } void CoinJoinWalletManager::DoMaintenance(CConnman& connman) diff --git a/src/coinjoin/client.h b/src/coinjoin/client.h index 26fd65008ba9..9fd50133de44 100644 --- a/src/coinjoin/client.h +++ b/src/coinjoin/client.h @@ -139,7 +139,6 @@ class CCoinJoinClientSession : public CCoinJoinBaseSession { private: const std::shared_ptr m_wallet; - CoinJoinWalletManager& m_walletman; CCoinJoinClientManager& m_clientman; CDeterministicMNManager& m_dmnman; CMasternodeMetaMan& m_mn_metaman; @@ -201,10 +200,9 @@ class CCoinJoinClientSession : public CCoinJoinBaseSession void SetNull() override EXCLUSIVE_LOCKS_REQUIRED(cs_coinjoin); public: - explicit CCoinJoinClientSession(const std::shared_ptr& wallet, CoinJoinWalletManager& walletman, - CCoinJoinClientManager& clientman, CDeterministicMNManager& dmnman, - CMasternodeMetaMan& mn_metaman, const CMasternodeSync& mn_sync, - const llmq::CInstantSendManager& isman, + explicit CCoinJoinClientSession(const std::shared_ptr& wallet, CCoinJoinClientManager& clientman, + CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, + const CMasternodeSync& mn_sync, const llmq::CInstantSendManager& isman, const std::unique_ptr& queueman, bool is_masternode); void ProcessMessage(CNode& peer, CChainState& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv); @@ -266,7 +264,6 @@ class CCoinJoinClientManager { private: const std::shared_ptr m_wallet; - CoinJoinWalletManager& m_walletman; CDeterministicMNManager& m_dmnman; CMasternodeMetaMan& m_mn_metaman; const CMasternodeSync& m_mn_sync; @@ -305,12 +302,11 @@ class CCoinJoinClientManager CCoinJoinClientManager(CCoinJoinClientManager const&) = delete; CCoinJoinClientManager& operator=(CCoinJoinClientManager const&) = delete; - explicit CCoinJoinClientManager(const std::shared_ptr& wallet, CoinJoinWalletManager& walletman, - CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, - const CMasternodeSync& mn_sync, const llmq::CInstantSendManager& isman, + explicit CCoinJoinClientManager(const std::shared_ptr& wallet, CDeterministicMNManager& dmnman, + CMasternodeMetaMan& mn_metaman, const CMasternodeSync& mn_sync, + const llmq::CInstantSendManager& isman, const std::unique_ptr& queueman, bool is_masternode) : m_wallet(wallet), - m_walletman(walletman), m_dmnman(dmnman), m_mn_metaman(mn_metaman), m_mn_sync(mn_sync), diff --git a/src/evo/creditpool.cpp b/src/evo/creditpool.cpp index c16950eba1f1..ce90cce4de6a 100644 --- a/src/evo/creditpool.cpp +++ b/src/evo/creditpool.cpp @@ -235,10 +235,10 @@ CCreditPoolManager::CCreditPoolManager(CEvoDB& _evoDb) { } -CCreditPoolDiff::CCreditPoolDiff(CCreditPool starter, const CBlockIndex *pindexPrev, const Consensus::Params& consensusParams, const CAmount blockSubsidy) : +CCreditPoolDiff::CCreditPoolDiff(CCreditPool starter, const CBlockIndex* pindexPrev, + const Consensus::Params& consensusParams, const CAmount blockSubsidy) : pool(std::move(starter)), - pindexPrev(pindexPrev), - params(consensusParams) + pindexPrev(pindexPrev) { assert(pindexPrev); diff --git a/src/evo/creditpool.h b/src/evo/creditpool.h index c27179edaa95..46572f4b39ed 100644 --- a/src/evo/creditpool.h +++ b/src/evo/creditpool.h @@ -75,7 +75,7 @@ class CCreditPoolDiff { CAmount platformReward{0}; const CBlockIndex *pindexPrev{nullptr}; - const Consensus::Params& params; + public: explicit CCreditPoolDiff(CCreditPool starter, const CBlockIndex *pindexPrev, const Consensus::Params& consensusParams, diff --git a/src/evo/deterministicmns.h b/src/evo/deterministicmns.h index 2d606568f6f6..58fb1a41739a 100644 --- a/src/evo/deterministicmns.h +++ b/src/evo/deterministicmns.h @@ -563,7 +563,6 @@ class CDeterministicMNManager // Main thread has indicated we should perform cleanup up to this height std::atomic to_cleanup {0}; - CChainState& m_chainstate; CEvoDB& m_evoDb; std::unordered_map mnListsCache GUARDED_BY(cs); @@ -572,8 +571,7 @@ class CDeterministicMNManager const CBlockIndex* m_initial_snapshot_index GUARDED_BY(cs) {nullptr}; public: - explicit CDeterministicMNManager(CChainState& chainstate, CEvoDB& evoDb) : - m_chainstate(chainstate), + explicit CDeterministicMNManager(CEvoDB& evoDb) : m_evoDb(evoDb) { } diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp index 3d0ad5c7766d..fbfad427d749 100644 --- a/src/node/chainstate.cpp +++ b/src/node/chainstate.cpp @@ -213,7 +213,7 @@ void DashChainstateSetup(ChainstateManager& chainman, { // Same logic as pblocktree dmnman.reset(); - dmnman = std::make_unique(chainman.ActiveChainstate(), *evodb); + dmnman = std::make_unique(*evodb); cpoolman.reset(); cpoolman = std::make_unique(*evodb); diff --git a/src/wallet/hdchain.h b/src/wallet/hdchain.h index 87af09871a97..6b89df5f5b78 100644 --- a/src/wallet/hdchain.h +++ b/src/wallet/hdchain.h @@ -122,7 +122,7 @@ class CHDPubKey { private: static const int CURRENT_VERSION = 1; - int nVersion{CHDPubKey::CURRENT_VERSION}; + [[maybe_unused]] int nVersion{CHDPubKey::CURRENT_VERSION}; public: CExtPubKey extPubKey{}; From 10cb3e4df5faba2d8319cc75268d7f910bcf551c Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Apr 2025 14:58:50 +0000 Subject: [PATCH 10/12] fix: resolve `-Wlogical-op-parentheses` warnings --- src/wallet/scriptpubkeyman.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index 82c38d713293..c12549110087 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -219,7 +219,7 @@ bool LegacyScriptPubKeyMan::CheckDecryptionKey(const CKeyingMaterial& master_key if (keyFail) { return false; } - if (!keyPass && !accept_no_keys && (m_hd_chain.IsNull() || !m_hd_chain.IsNull() && !m_hd_chain.IsCrypted())) { + if (!keyPass && !accept_no_keys && (m_hd_chain.IsNull() || (!m_hd_chain.IsNull() && !m_hd_chain.IsCrypted()))) { return false; } From 1015f9bc4deea6d54093367d44b2ed64312a6c50 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Apr 2025 15:00:47 +0000 Subject: [PATCH 11/12] fix: resolve `-Wunreachable-code` warnings, add comment for explanation --- src/wallet/spend.cpp | 3 ++- src/wallet/wallet.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index 126ce98901d5..92f9b2405a14 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -373,7 +373,8 @@ bool CWallet::AttemptSelection(const CAmount& nTargetValue, const CoinEligibilit std::vector positive_groups = GroupOutputs(coins, coin_selection_params, eligibility_filter, true /* positive_only */); std::set bnb_coins; CAmount bnb_value; - if (false && SelectCoinsBnB(positive_groups, nTargetValue, coin_selection_params.m_cost_of_change, bnb_coins, bnb_value)) { + // Note: BnB is disabled because it is unaware of mixed coins + if (/* DISABLES CODE */ (false) && SelectCoinsBnB(positive_groups, nTargetValue, coin_selection_params.m_cost_of_change, bnb_coins, bnb_value)) { const auto waste = GetSelectionWaste(bnb_coins, /* cost of change */ CAmount(0), nTargetValue, !coin_selection_params.m_subtract_fee_outputs); results.emplace_back(std::make_tuple(waste, std::move(bnb_coins), bnb_value)); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index cf22cb313d1b..b5c9b46dd295 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3702,7 +3702,7 @@ bool CWallet::UpgradeWallet(int version, bilingual_str& error) } // TODO: consider discourage users to skip passphrase for HD wallets for v21 - if (false && nMaxVersion >= FEATURE_HD && !IsHDEnabled()) { + if (/* DISABLES CODE */ (false) && nMaxVersion >= FEATURE_HD && !IsHDEnabled()) { error = Untranslated("You should use upgradetohd RPC to upgrade non-HD wallet to HD"); error = strprintf(_("Cannot upgrade a non HD wallet from version %i to version %i which is non-HD wallet. Use upgradetohd RPC"), prev_version, version); return false; From c7748cda4ed8a9a1e3b447f5b038f1b37dea3744 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Apr 2025 19:27:50 +0000 Subject: [PATCH 12/12] revert: don't build using `-Werror` when using Clang reverts: - e43a9ea00e26146360086e2d321f34b792032248. --- ci/test/00_setup_env_mac.sh | 1 - ci/test/00_setup_env_native_fuzz.sh | 1 - ci/test/00_setup_env_native_multiprocess.sh | 1 - ci/test/00_setup_env_native_tsan.sh | 1 - ci/test/00_setup_env_native_ubsan.sh | 1 - ci/test/00_setup_env_native_valgrind.sh | 1 - 6 files changed, 6 deletions(-) diff --git a/ci/test/00_setup_env_mac.sh b/ci/test/00_setup_env_mac.sh index 8527c4e603c2..aba312bf78af 100755 --- a/ci/test/00_setup_env_mac.sh +++ b/ci/test/00_setup_env_mac.sh @@ -15,4 +15,3 @@ export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export GOAL="all deploy" export BITCOIN_CONFIG="--with-gui --enable-reduce-exports --disable-miner --with-boost-process" -export NO_WERROR=1 diff --git a/ci/test/00_setup_env_native_fuzz.sh b/ci/test/00_setup_env_native_fuzz.sh index 05895c95c46b..18929cc2b2f0 100755 --- a/ci/test/00_setup_env_native_fuzz.sh +++ b/ci/test/00_setup_env_native_fuzz.sh @@ -16,4 +16,3 @@ export RUN_FUNCTIONAL_TESTS=false export RUN_FUZZ_TESTS=true export GOAL="install" export BITCOIN_CONFIG="--enable-zmq --disable-ccache --enable-fuzz --with-sanitizers=fuzzer,address,undefined,integer CC='clang-18 -ftrivial-auto-var-init=pattern' CXX='clang++-18 -ftrivial-auto-var-init=pattern' --with-boost-process" -export NO_WERROR=1 diff --git a/ci/test/00_setup_env_native_multiprocess.sh b/ci/test/00_setup_env_native_multiprocess.sh index 72942113084b..7ab95903d131 100755 --- a/ci/test/00_setup_env_native_multiprocess.sh +++ b/ci/test/00_setup_env_native_multiprocess.sh @@ -17,4 +17,3 @@ export BITCOIN_CONFIG="--with-boost-process --enable-debug CC=clang-18 CXX=clang # Additional flags for RUN_TIDY export BITCOIN_CONFIG="${BITCOIN_CONFIG} --disable-hardening CFLAGS='-O0 -g0' CXXFLAGS='-O0 -g0 -Wno-error=documentation'" export BITCOIND=dash-node # Used in functional tests -export NO_WERROR=1 diff --git a/ci/test/00_setup_env_native_tsan.sh b/ci/test/00_setup_env_native_tsan.sh index 08d69881a9e5..3820e469aa5f 100755 --- a/ci/test/00_setup_env_native_tsan.sh +++ b/ci/test/00_setup_env_native_tsan.sh @@ -15,4 +15,3 @@ export GOAL="install" export BITCOIN_CONFIG="--enable-zmq --with-sanitizers=thread CC=clang-18 CXX=clang++-18 CXXFLAGS='-g' --with-boost-process" export CPPFLAGS="-DARENA_DEBUG -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION" export PYZMQ=true -export NO_WERROR=1 diff --git a/ci/test/00_setup_env_native_ubsan.sh b/ci/test/00_setup_env_native_ubsan.sh index 9af2bdae9882..9fb440dfd41e 100755 --- a/ci/test/00_setup_env_native_ubsan.sh +++ b/ci/test/00_setup_env_native_ubsan.sh @@ -13,4 +13,3 @@ export DEP_OPTS="NO_UPNP=1 DEBUG=1" export GOAL="install" export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --with-sanitizers=undefined CC=clang-18 CXX=clang++-18" export PYZMQ=true -export NO_WERROR=1 diff --git a/ci/test/00_setup_env_native_valgrind.sh b/ci/test/00_setup_env_native_valgrind.sh index 79e1ff568a10..fdb2b7375b4c 100755 --- a/ci/test/00_setup_env_native_valgrind.sh +++ b/ci/test/00_setup_env_native_valgrind.sh @@ -12,4 +12,3 @@ export NO_DEPENDS=1 export TEST_RUNNER_EXTRA="--exclude rpc_bind,feature_bind_extra --timeout-factor=4" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547 export GOAL="install" export BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=no CC=clang-18 CXX=clang++-18" # TODO enable GUI -export NO_WERROR=1