From dcbf67155173bf5b25ed527c613f4727a5295fe4 Mon Sep 17 00:00:00 2001 From: merge-script Date: Wed, 22 May 2024 13:43:33 +0100 Subject: [PATCH 1/3] Merge bitcoin/bitcoin#30131: wallet, tests: Avoid stringop-overflow warning in PollutePubKey MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2289d4524053ab71c0d9133987cb36412797c1a2 wallet, tests: Avoid stringop-overflow warning in PollutePubKey (Ava Chow) Pull request description: Fixes #30114 ACKs for top commit: maflcko: ACK 2289d4524053ab71c0d9133987cb36412797c1a2 with g++ 14.1.1 🦄 theStack: utACK 2289d4524053ab71c0d9133987cb36412797c1a2 laanwj: ACK 2289d4524053ab71c0d9133987cb36412797c1a2 Tree-SHA512: 173c3c299bdd890f73e8a67a37880dbf816265e8b3c8298557ef2fc4670f5447005c0d2d81726f9bc43f6a69d677365d90a604354b3cbab0e3c52c4526d0407e --- src/wallet/test/wallet_tests.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index ef6218ed6f71..e7aa85c6d49f 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -531,8 +531,10 @@ static void TestWatchOnlyPubKey(LegacyScriptPubKeyMan* spk_man, const CPubKey& a // Cryptographically invalidate a PubKey whilst keeping length and first byte static void PollutePubKey(CPubKey& pubkey) { - std::vector pubkey_raw(pubkey.begin(), pubkey.end()); - std::fill(pubkey_raw.begin()+1, pubkey_raw.end(), 0); + assert(pubkey.size() >= 1); + std::vector pubkey_raw; + pubkey_raw.push_back(pubkey[0]); + pubkey_raw.insert(pubkey_raw.end(), pubkey.size() - 1, 0); pubkey = CPubKey(pubkey_raw); assert(!pubkey.IsFullyValid()); assert(pubkey.IsValid()); From a3e6378108e2908075edbb8ee13509a415bd7d37 Mon Sep 17 00:00:00 2001 From: fanquake Date: Wed, 20 Oct 2021 13:13:44 +0800 Subject: [PATCH 2/3] Merge bitcoin/bitcoin#23258: doc: Fix outdated comments referring to ::ChainActive() BACKPORT NOTE: changes for TestLockPointValidity in src/validation.cpp are applied to the same function but in src/txmempool.cpp a0efe529e4fd053b890450413b9ca5e1bcd8f2c2 Fix outdated comments referring to ::ChainActive() (Samuel Dobson) Pull request description: After #21866 there are a few outdated comments referring to `::ChainActive()`, which should instead refer to `ChainstateManager::ActiveChain()`. ACKs for top commit: jamesob: ACK https://github.com/bitcoin/bitcoin/pull/23258/commits/a0efe529e4fd053b890450413b9ca5e1bcd8f2c2 Tree-SHA512: 80da19c105ed29ac247e6df4c8e916c3bf3f37230b63f07302114eef9c115add673e9649f0bbe237295be0c6da7b1030b5b93e14daf6768f17ce5de7cf2c9ff2 --- src/index/base.cpp | 2 +- src/policy/fees.cpp | 2 +- src/txmempool.h | 2 +- src/validation.h | 2 +- src/wallet/wallet.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index/base.cpp b/src/index/base.cpp index 539041143261..e62da821f1ca 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -331,7 +331,7 @@ bool BaseIndex::BlockUntilSyncedToCurrentChain() const { // Skip the queue-draining stuff if we know we're caught up with - // ::ChainActive().Tip(). + // m_chain.Tip(). LOCK(cs_main); const CBlockIndex* chain_tip = m_chainstate->m_chain.Tip(); const CBlockIndex* best_block_index = m_best_block_index.load(); diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index e1ce1bfdb6c8..caf4f0b5f836 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -554,7 +554,7 @@ void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry& entry, boo if (txHeight != nBestSeenHeight) { // Ignore side chains and re-orgs; assuming they are random they don't // affect the estimate. We'll potentially double count transactions in 1-block reorgs. - // Ignore txs if BlockPolicyEstimator is not in sync with ::ChainActive().Tip(). + // Ignore txs if BlockPolicyEstimator is not in sync with ActiveChain().Tip(). // It will be synced next time a block is processed. return; } diff --git a/src/txmempool.h b/src/txmempool.h index 13f2b964d266..994acf668a31 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -498,7 +498,7 @@ class CTxMemPool * By design, it is guaranteed that: * * 1. Locking both `cs_main` and `mempool.cs` will give a view of mempool - * that is consistent with current chain tip (`::ChainActive()` and + * that is consistent with current chain tip (`ActiveChain()` and * `CoinsTip()`) and is fully populated. Fully populated means that if the * current active chain is missing transactions that were present in a * previously active chain, all the missing transactions will have been diff --git a/src/validation.h b/src/validation.h index df67b6e9d2eb..1a1abbb5f4fb 100644 --- a/src/validation.h +++ b/src/validation.h @@ -101,7 +101,7 @@ static const bool DEFAULT_SYNC_MEMPOOL = true; /** Default for -stopatheight */ static const int DEFAULT_STOPATHEIGHT = 0; -/** Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ::ChainActive().Tip() will not be pruned. */ +/** Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ActiveChain().Tip() will not be pruned. */ static const unsigned int MIN_BLOCKS_TO_KEEP = 288; static const signed int DEFAULT_CHECKBLOCKS = 6; static const unsigned int DEFAULT_CHECKLEVEL = 3; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index edc7b41c9ef8..776c8e28ce4a 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1366,7 +1366,7 @@ void CWallet::updatedBlockTip() void CWallet::BlockUntilSyncedToCurrentChain() const { AssertLockNotHeld(cs_wallet); // Skip the queue-draining stuff if we know we're caught up with - // chainActive.Tip(), otherwise put a callback in the validation interface queue and wait + // chain().Tip(), otherwise put a callback in the validation interface queue and wait // for the queue to drain enough to execute it (indicating we are caught up // at least with the time we entered this function). uint256 last_block_hash = WITH_LOCK(cs_wallet, return m_last_block_processed); From e994691e2d5ed53c071218814aac25b5336b490c Mon Sep 17 00:00:00 2001 From: merge-script Date: Tue, 23 Jul 2024 13:31:55 +0100 Subject: [PATCH 3/3] Merge bitcoin/bitcoin#30504: doc: use proper doxygen formatting for CTxMemPool::cs 6a5e9e40e1dd3d397020703feb9aa0b6f4577c98 doc: use proper doxygen formatting for CTxMemPool::cs (Vasil Dimov) Pull request description: Having `@par title` followed by an empty line renders improperly in Doxygen - it results in a paragraph with a title but without a body. https://www.doxygen.nl/manual/commands.html#cmdpar This also results in a compiler warning (or error) with Clang 19: ``` ./txmempool.h:368:34: error: empty paragraph passed to '@par' command [-Werror,-Wdocumentation] 368 | * @par Consistency guarantees | ~~~~~~~~~~~~~~~~~~~~~~~~~~^ 1 error generated. ``` ACKs for top commit: maflcko: review ACK 6a5e9e40e1dd3d397020703feb9aa0b6f4577c98 tdb3: ACK 6a5e9e40e1dd3d397020703feb9aa0b6f4577c98 Tree-SHA512: 2c4c9e5fd4bd44754800a9bcfff74df101afc060b84451c45aa098e4ceb05a47f28a36f8473b31222552fad6339b752a148e6b1c7d41c2003f515b3eb4060902 --- src/txmempool.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/txmempool.h b/src/txmempool.h index 994acf668a31..9cdf1ccc1c14 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -494,9 +494,7 @@ class CTxMemPool * that are guarded by it. * * @par Consistency guarantees - * * By design, it is guaranteed that: - * * 1. Locking both `cs_main` and `mempool.cs` will give a view of mempool * that is consistent with current chain tip (`ActiveChain()` and * `CoinsTip()`) and is fully populated. Fully populated means that if the @@ -504,7 +502,6 @@ class CTxMemPool * previously active chain, all the missing transactions will have been * re-added to the mempool and should be present if they meet size and * consistency constraints. - * * 2. Locking `mempool.cs` without `cs_main` will give a view of a mempool * consistent with some chain that was active since `cs_main` was last * locked, and that is fully populated as described above. It is ok for