mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-09 06:09:48 +02:00
Merge bitcoin/bitcoin#24050: validation: Give m_block_index ownership of CBlockIndexs
6c23c41561refactor: Rewrite AddToBlockIndex with try_emplace (Carl Dong)c05cf7aa1estyle: Modernize range-based loops over m_block_index (Carl Dong)c2a1655799style-only: Use using instead of typedef for BlockMap (Carl Dong)dd79dad175refactor: Rewrite InsertBlockIndex with try_emplace (Carl Dong)531dce0347tests: Remove now-unnecessary manual Unload's (Carl Dong)bec86ae326blockstorage: Make m_block_index own CBlockIndex's (Carl Dong) Pull request description: Part of: #24303 Split off from: #22564 ``` Instead of having CBlockIndex's live on the heap, which requires manual memory management, have them be owned by m_block_index. This means that they will live and die with BlockManager. ``` The second commit demonstrates how this makes calls to `Unload()` to satisfy the address sanitizer unnecessary. ACKs for top commit: ajtowns: ACK6c23c41561MarcoFalke: re-ACK6c23c41561🎨 Tree-SHA512: 81b2b5119be27cc0f8a9457b11da60cc60930315d2a5be36be89fe253d32073ffe622348ff153114b9b3212197bddbc791810913a43811b33cc58e7162bd105b
This commit is contained in:
@@ -1753,10 +1753,10 @@ static RPCHelpMan getchaintips()
|
||||
std::set<const CBlockIndex*> setOrphans;
|
||||
std::set<const CBlockIndex*> setPrevs;
|
||||
|
||||
for (const std::pair<const uint256, CBlockIndex*>& item : chainman.BlockIndex()) {
|
||||
if (!active_chain.Contains(item.second)) {
|
||||
setOrphans.insert(item.second);
|
||||
setPrevs.insert(item.second->pprev);
|
||||
for (const auto& [_, block_index] : chainman.BlockIndex()) {
|
||||
if (!active_chain.Contains(&block_index)) {
|
||||
setOrphans.insert(&block_index);
|
||||
setPrevs.insert(block_index.pprev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user