aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/files.md2
-rw-r--r--src/addrdb.cpp13
-rw-r--r--src/addrdb.h6
-rw-r--r--src/banman.cpp2
-rw-r--r--src/banman.h2
-rw-r--r--src/test/fuzz/banman.cpp4
6 files changed, 12 insertions, 17 deletions
diff --git a/doc/files.md b/doc/files.md
index e670d77ae5..f88d3f91a1 100644
--- a/doc/files.md
+++ b/doc/files.md
@@ -56,7 +56,6 @@ Subdirectory | File(s) | Description
`indexes/coinstats/db/` | LevelDB database | Coinstats index; *optional*, used if `-coinstatsindex=1`
`wallets/` | | [Contains wallets](#multi-wallet-environment); can be specified by `-walletdir` option; if `wallets/` subdirectory does not exist, wallets reside in the [data directory](#data-directory-location)
`./` | `anchors.dat` | Anchor IP address database, created on shutdown and deleted at startup. Anchors are last known outgoing block-relay-only peers that are tried to re-connect to on startup
-`./` | `banlist.dat` | Stores the addresses/subnets of banned nodes (deprecated). `bitcoind` or `bitcoin-qt` no longer save the banlist to this file, but read it on startup if `banlist.json` is not present.
`./` | `banlist.json` | Stores the addresses/subnets of banned nodes.
`./` | `bitcoin.conf` | User-defined [configuration settings](bitcoin-conf.md) for `bitcoind` or `bitcoin-qt`. File is not written to by the software and must be created manually. Path can be specified by `-conf` option
`./` | `bitcoind.pid` | Stores the process ID (PID) of `bitcoind` or `bitcoin-qt` while running; created at start and deleted on shutdown; can be specified by `-pid` option
@@ -114,6 +113,7 @@ These subdirectories and files are no longer used by Bitcoin Core:
Path | Description | Repository notes
---------------|-------------|-----------------
+`banlist.dat` | Stores the addresses/subnets of banned nodes; superseded by `banlist.json` in 22.0 and completely ignored in 23.0 | [PR #20966](https://github.com/bitcoin/bitcoin/pull/20966), [PR #22570](https://github.com/bitcoin/bitcoin/pull/22570)
`blktree/` | Blockchain index; replaced by `blocks/index/` in [0.8.0](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.8.0.md#improvements) | [PR #2231](https://github.com/bitcoin/bitcoin/pull/2231), [`8fdc94cc`](https://github.com/bitcoin/bitcoin/commit/8fdc94cc8f0341e96b1edb3a5b56811c0b20bd15)
`coins/` | Unspent transaction output database; replaced by `chainstate/` in 0.8.0 | [PR #2231](https://github.com/bitcoin/bitcoin/pull/2231), [`8fdc94cc`](https://github.com/bitcoin/bitcoin/commit/8fdc94cc8f0341e96b1edb3a5b56811c0b20bd15)
`blkindex.dat` | Blockchain index BDB database; replaced by {`chainstate/`, `blocks/index/`, `blocks/revNNNNN.dat`<sup>[\[2\]](#note2)</sup>} in 0.8.0 | [PR #1677](https://github.com/bitcoin/bitcoin/pull/1677)
diff --git a/src/addrdb.cpp b/src/addrdb.cpp
index b8fd019bab..c3e224ee83 100644
--- a/src/addrdb.cpp
+++ b/src/addrdb.cpp
@@ -197,17 +197,16 @@ bool CBanDB::Write(const banmap_t& banSet)
return false;
}
-bool CBanDB::Read(banmap_t& banSet, bool& dirty)
+bool CBanDB::Read(banmap_t& banSet)
{
- // If the JSON banlist does not exist, then try to read the non-upgraded banlist.dat.
+ if (fs::exists(m_banlist_dat)) {
+ LogPrintf("banlist.dat ignored because it can only be read by " PACKAGE_NAME " version 22.x. Remove %s to silence this warning.\n", m_banlist_dat);
+ }
+ // If the JSON banlist does not exist, then recreate it
if (!fs::exists(m_banlist_json)) {
- // If this succeeds then we need to flush to disk in order to create the JSON banlist.
- dirty = true;
- return DeserializeFileDB(m_banlist_dat, banSet, CLIENT_VERSION);
+ return false;
}
- dirty = false;
-
std::map<std::string, util::SettingsValue> settings;
std::vector<std::string> errors;
diff --git a/src/addrdb.h b/src/addrdb.h
index 399103c991..1e0ccb1f60 100644
--- a/src/addrdb.h
+++ b/src/addrdb.h
@@ -76,7 +76,7 @@ public:
static bool Read(CAddrMan& addr, CDataStream& ssPeers);
};
-/** Access to the banlist databases (banlist.json and banlist.dat) */
+/** Access to the banlist database (banlist.json) */
class CBanDB
{
private:
@@ -95,11 +95,9 @@ public:
* Read the banlist from disk.
* @param[out] banSet The loaded list. Set if `true` is returned, otherwise it is left
* in an undefined state.
- * @param[out] dirty Indicates whether the loaded list needs flushing to disk. Set if
- * `true` is returned, otherwise it is left in an undefined state.
* @return true on success
*/
- bool Read(banmap_t& banSet, bool& dirty);
+ bool Read(banmap_t& banSet);
};
/**
diff --git a/src/banman.cpp b/src/banman.cpp
index d2437e6733..c64a48a05a 100644
--- a/src/banman.cpp
+++ b/src/banman.cpp
@@ -18,7 +18,7 @@ BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t
if (m_client_interface) m_client_interface->InitMessage(_("Loading banlist…").translated);
int64_t n_start = GetTimeMillis();
- if (m_ban_db.Read(m_banned, m_is_dirty)) {
+ if (m_ban_db.Read(m_banned)) {
SweepBanned(); // sweep out unused entries
LogPrint(BCLog::NET, "Loaded %d banned node addresses/subnets %dms\n", m_banned.size(),
diff --git a/src/banman.h b/src/banman.h
index 8c75d4037e..8a03a9e3fc 100644
--- a/src/banman.h
+++ b/src/banman.h
@@ -88,7 +88,7 @@ private:
RecursiveMutex m_cs_banned;
banmap_t m_banned GUARDED_BY(m_cs_banned);
- bool m_is_dirty GUARDED_BY(m_cs_banned);
+ bool m_is_dirty GUARDED_BY(m_cs_banned){false};
CClientUIInterface* m_client_interface = nullptr;
CBanDB m_ban_db;
const int64_t m_default_ban_time;
diff --git a/src/test/fuzz/banman.cpp b/src/test/fuzz/banman.cpp
index 1986b5e4c8..de211f601f 100644
--- a/src/test/fuzz/banman.cpp
+++ b/src/test/fuzz/banman.cpp
@@ -52,8 +52,7 @@ FUZZ_TARGET_INIT(banman, initialize_banman)
const bool start_with_corrupted_banlist{fuzzed_data_provider.ConsumeBool()};
bool force_read_and_write_to_err{false};
if (start_with_corrupted_banlist) {
- const std::string sfx{fuzzed_data_provider.ConsumeBool() ? ".dat" : ".json"};
- assert(WriteBinaryFile(banlist_file.string() + sfx,
+ assert(WriteBinaryFile(banlist_file.string() + ".json",
fuzzed_data_provider.ConsumeRandomLengthString()));
} else {
force_read_and_write_to_err = fuzzed_data_provider.ConsumeBool();
@@ -114,6 +113,5 @@ FUZZ_TARGET_INIT(banman, initialize_banman)
(void)(banmap == banmap_read);
}
}
- fs::remove(banlist_file.string() + ".dat");
fs::remove(banlist_file.string() + ".json");
}