mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
Merge bitcoin/bitcoin#22791: init: Fix asmap/addrman initialization order bug
724c497562[fuzz] Add ConsumeAsmap() function (John Newbery)5840476714[addrman] Make m_asmap private (John Newbery)f9002cb5db[net] Rename the copyStats arg from m_asmap to asmap (John Newbery)f572f2b204[addrman] Set m_asmap in CAddrMan initializer list (John Newbery)593247872d[net] Remove CConnMan::SetAsmap() (John Newbery)50fd77045e[init] Read/decode asmap before constructing addrman (John Newbery) Pull request description: Commit181a1207introduced an initialization order bug: CAddrMan's m_asmap must be set before deserializing peers.dat. The first commit restores the correct initialization order. The remaining commits make `CAddrMan::m_asmap` usage safer: - don't reach into `CAddrMan`'s internal data from `CConnMan` - set `m_asmap` in the initializer list and make it const - make `m_asmap` private, and access it (as a reference to const) from a getter. This ensures that peers.dat deserialization must happen after setting m_asmap, since m_asmap is set during CAddrMan construction. ACKs for top commit: mzumsande: Tested ACK724c497562amitiuttarwar: code review but utACK724c497562naumenkogs: utACK724c497562vasild: ACK724c497562MarcoFalke: review ACK724c497562👫 Tree-SHA512: 684a4cf9e3d4496c9997fb2bc4ec874809987055c157ec3fad1d2143b8223df52b5a0af787d028930b27388c8efeba0aeb2446cb35c337a5552ae76112ade726
This commit is contained in:
@@ -188,7 +188,7 @@ FUZZ_TARGET_DESERIALIZE(blockmerkleroot, {
|
||||
BlockMerkleRoot(block, &mutated);
|
||||
})
|
||||
FUZZ_TARGET_DESERIALIZE(addrman_deserialize, {
|
||||
CAddrMan am(/* deterministic */ false, /* consistency_check_ratio */ 0);
|
||||
CAddrMan am(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
|
||||
DeserializeFromFuzzingInput(buffer, am);
|
||||
})
|
||||
FUZZ_TARGET_DESERIALIZE(blockheader_deserialize, {
|
||||
|
||||
Reference in New Issue
Block a user