I deliberately avoid removing banlist.dat
automatically because that would prevent downgrading to an older version (and keeping the ban list).
Something like this may be a good idea:
0--- i/src/addrdb.cpp
1+++ w/src/addrdb.cpp
2@@ -185,12 +185,18 @@ CBanDB::CBanDB(fs::path ban_list_path)
3 }
4
5 bool CBanDB::Write(const banmap_t& banSet)
6 {
7 std::vector<std::string> errors;
8 if (util::WriteSettings(m_banlist_json, {{JSON_KEY, BanMapToJson(banSet)}}, errors)) {
9+ if (fs::exists(m_banlist_dat)) {
10+ LogPrintf("Successfully saved %s to disk. %s can be removed manually now if "
11+ "downgrading to an older version is not planned.\n",
12+ m_banlist_json.string(),
13+ m_banlist_dat.string());
14+ }
15 return true;
16 }
17
18 for (const auto& err : errors) {
19 error("%s", err);
20 }
but it would be printed every time which would be annoying. There is some doc added to doc/files.md
which should clarify things if the user wonders why there are two files. Maybe leave it as is?
We can add an automatic removal of banlist.dat
one major version after this change is released.