asmap: Make outputted ASMap version match externally computed hashes

* Change version from double to single SHA256
  This invalidates serialized AddrMan data which forces re-bucketing.

* Avoid reversing byte order for ASMap version in log
  Makes it easier to match it with externally computed hashes of the encoded file.
This commit is contained in:
Hodlinator
2026-09-10 11:31:04 +02:00
parent fc4f35fdce
commit 7ee94bf4b0
3 changed files with 3 additions and 3 deletions

View File

@@ -1701,7 +1701,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
return false;
#endif
}
LogInfo("Using asmap version %s for IP bucketing", asmap_version.ToString());
LogInfo("Using asmap version %s for IP bucketing", HexStr(asmap_version));
} else {
node.netgroupman = std::make_unique<NetGroupManager>(NetGroupManager::NoAsmap());
LogInfo("Using /16 prefix for IP bucketing");

View File

@@ -349,5 +349,5 @@ uint256 AsmapVersion(const std::span<const std::byte> data)
HashWriter asmap_hasher;
asmap_hasher << data;
return asmap_hasher.GetHash();
return asmap_hasher.GetSHA256();
}

View File

@@ -22,7 +22,7 @@ from test_framework.util import (
)
ASMAP = 'src/test/data/asmap.raw' # path to unit test skeleton asmap
VERSION = 'bafc9da308f45179443bd1d22325400ac9104f741522d003e3fac86700f68895'
VERSION = '55dcec00c72b8a33a271dad20271e14cfbe5526aa1dc12e2559f30c376d85a35'
def expected_messages(filename):
return [f'Opened asmap file "{filename}" (59 bytes) from disk',