diff options
author | John Newbery <john@johnnewbery.com> | 2021-09-01 16:34:23 +0100 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2022-04-20 14:35:53 +0100 |
commit | 4709fc2019e27e74be02dc5fc123b9f6f46d7990 (patch) | |
tree | 25170c62329cab5a2a8afe7989f785f59d7ac9a0 /src/addrman.cpp | |
parent | 1b978a7e8c71dcc1501705022e66f6779c8c4528 (diff) | |
download | bitcoin-4709fc2019e27e74be02dc5fc123b9f6f46d7990.tar.xz |
[netgroupman] Move asmap checksum calculation to NetGroupManager
Diffstat (limited to 'src/addrman.cpp')
-rw-r--r-- | src/addrman.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp index 7abec560eb..f74729d47b 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -218,11 +218,7 @@ void AddrManImpl::Serialize(Stream& s_) const } // Store asmap checksum after bucket entries so that it // can be ignored by older clients for backward compatibility. - uint256 asmap_checksum; - if (m_netgroupman.GetAsmap().size() != 0) { - asmap_checksum = SerializeHash(m_netgroupman.GetAsmap()); - } - s << asmap_checksum; + s << m_netgroupman.GetAsmapChecksum(); } template <typename Stream> @@ -335,10 +331,7 @@ void AddrManImpl::Unserialize(Stream& s_) // If the bucket count and asmap checksum haven't changed, then attempt // to restore the entries to the buckets/positions they were in before // serialization. - uint256 supplied_asmap_checksum; - if (m_netgroupman.GetAsmap().size() != 0) { - supplied_asmap_checksum = SerializeHash(m_netgroupman.GetAsmap()); - } + uint256 supplied_asmap_checksum{m_netgroupman.GetAsmapChecksum()}; uint256 serialized_asmap_checksum; if (format >= Format::V2_ASMAP) { s >> serialized_asmap_checksum; |