diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-09-06 12:41:31 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-09-06 12:41:36 +0200 |
commit | a8fdfea77b0cdfcbc406558435968c1b801a5fdd (patch) | |
tree | de829ce0c6de4c158c56d4300509e53578a09838 /src/test/fuzz/net.cpp | |
parent | 2c6707be8b62ec56a6e2017b43c167b319ef17c3 (diff) | |
parent | 724c4975622bc22cedc3f3814dfc8e66cf8371f7 (diff) | |
download | bitcoin-a8fdfea77b0cdfcbc406558435968c1b801a5fdd.tar.xz |
Merge bitcoin/bitcoin#22791: init: Fix asmap/addrman initialization order bug
724c4975622bc22cedc3f3814dfc8e66cf8371f7 [fuzz] Add ConsumeAsmap() function (John Newbery)
5840476714ffebb2599999c85a23b52ebcff6090 [addrman] Make m_asmap private (John Newbery)
f9002cb5dbd573cd9ca200de21319fa296e26055 [net] Rename the copyStats arg from m_asmap to asmap (John Newbery)
f572f2b2048994b3b50f4cfd5de19e40b1acfb22 [addrman] Set m_asmap in CAddrMan initializer list (John Newbery)
593247872decd6d483a76e96d79433247226ad14 [net] Remove CConnMan::SetAsmap() (John Newbery)
50fd77045e2f858a53486b5e02e1798c92ab946c [init] Read/decode asmap before constructing addrman (John Newbery)
Pull request description:
Commit 181a1207 introduced 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 ACK 724c4975622bc22cedc3f3814dfc8e66cf8371f7
amitiuttarwar:
code review but utACK 724c497562
naumenkogs:
utACK 724c4975622bc22cedc3f3814dfc8e66cf8371f7
vasild:
ACK 724c4975622bc22cedc3f3814dfc8e66cf8371f7
MarcoFalke:
review ACK 724c4975622bc22cedc3f3814dfc8e66cf8371f7 👫
Tree-SHA512: 684a4cf9e3d4496c9997fb2bc4ec874809987055c157ec3fad1d2143b8223df52b5a0af787d028930b27388c8efeba0aeb2446cb35c337a5552ae76112ade726
Diffstat (limited to 'src/test/fuzz/net.cpp')
-rw-r--r-- | src/test/fuzz/net.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/fuzz/net.cpp b/src/test/fuzz/net.cpp index 9a579c053f..ff0259c182 100644 --- a/src/test/fuzz/net.cpp +++ b/src/test/fuzz/net.cpp @@ -43,7 +43,7 @@ FUZZ_TARGET_INIT(net, initialize_net) return; } CNodeStats stats; - node.copyStats(stats, asmap); + node.CopyStats(stats, asmap); }, [&] { const CNode* add_ref_node = node.AddRef(); |