aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-02-23 16:03:05 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-02-23 16:03:19 +0100
commit78effb37f35ff09733e79497bd6b06d355272d79 (patch)
tree58c8c0837b057bf9da8accacc2b50b856cd2efb6
parent84f6c695c6a2f2126ef693dc8c22e7a579c47b7f (diff)
parentfaf48f20f196e418b2eea390a0140db3604cfa15 (diff)
downloadbitcoin-78effb37f35ff09733e79497bd6b06d355272d79.tar.xz
Merge #21222: log: Clarify log message when file does not exist
faf48f20f196e418b2eea390a0140db3604cfa15 log: Clarify log message when file does not exist (MarcoFalke) Pull request description: Shorter and broader alternative to #21181 Rendered diff: ```diff @@ -1,4 +1,4 @@ -Bitcoin Core version v21.99.0-db656db2ed5a (release build) +Bitcoin Core version v21.99.0-faf48f20f196 (release build) Qt 5.15.2 (dynamic), plugin=wayland (dynamic) No static plugins. Style: adwaita / Adwaita::Style @@ -24,8 +24,8 @@ scheduler thread start Using wallet directory /tmp/test_001/regtest/wallets init message: Verifying wallet(s)... init message: Loading banlist... -ERROR: DeserializeFileDB: Failed to open file /tmp/test_001/regtest/banlist.dat -Invalid or missing banlist.dat; recreating +Missing or invalid file /tmp/test_001/regtest/banlist.dat +Recreating banlist.dat SetNetworkActive: true Failed to read fee estimates from /tmp/test_001/regtest/fee_estimates.dat. Continue anyway. Using /16 prefix for IP bucketing @@ -63,9 +63,9 @@ Bound to [::]:18444 Bound to 0.0.0.0:18444 Bound to 127.0.0.1:18445 init message: Loading P2P addresses... -ERROR: DeserializeFileDB: Failed to open file /tmp/test_001/regtest/peers.dat -Invalid or missing peers.dat; recreating -ERROR: DeserializeFileDB: Failed to open file /tmp/test_001/regtest/anchors.dat +Missing or invalid file /tmp/test_001/regtest/peers.dat +Recreating peers.dat +Missing or invalid file /tmp/test_001/regtest/anchors.dat 0 block-relay-only anchors will be tried for connections. init message: Starting network threads... net thread start ACKs for top commit: jnewbery: utACK faf48f20f196e418b2eea390a0140db3604cfa15 amitiuttarwar: utACK faf48f20f1, 👍 for consistency. also checked where we create / load other `.dat` files, looks good to me. practicalswift: cr ACK faf48f20f196e418b2eea390a0140db3604cfa15 Tree-SHA512: 697a728ef2b9f203363ac00b03eaf23ddf80bee043ecd3719265a0d884e8cfe88cd39afe946c86ab849edd1c836f05ec51125f052bdc14fe184b84447567756f
-rw-r--r--src/addrdb.cpp12
-rw-r--r--src/banman.cpp2
-rw-r--r--src/net.cpp2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/addrdb.cpp b/src/addrdb.cpp
index 8f77ed35ce..0922c1c432 100644
--- a/src/addrdb.cpp
+++ b/src/addrdb.cpp
@@ -109,15 +109,15 @@ template <typename Data>
bool DeserializeFileDB(const fs::path& path, Data& data)
{
// open input file, and associate with CAutoFile
- FILE *file = fsbridge::fopen(path, "rb");
+ FILE* file = fsbridge::fopen(path, "rb");
CAutoFile filein(file, SER_DISK, CLIENT_VERSION);
- if (filein.IsNull())
- return error("%s: Failed to open file %s", __func__, path.string());
-
+ if (filein.IsNull()) {
+ LogPrintf("Missing or invalid file %s\n", path.string());
+ return false;
+ }
return DeserializeDB(filein, data);
}
-
-}
+} // namespace
CBanDB::CBanDB(fs::path ban_list_path) : m_ban_list_path(std::move(ban_list_path))
{
diff --git a/src/banman.cpp b/src/banman.cpp
index 49bf6c43dc..3fe561ad01 100644
--- a/src/banman.cpp
+++ b/src/banman.cpp
@@ -28,7 +28,7 @@ BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t
LogPrint(BCLog::NET, "Loaded %d banned node ips/subnets from banlist.dat %dms\n",
m_banned.size(), GetTimeMillis() - n_start);
} else {
- LogPrintf("Invalid or missing banlist.dat; recreating\n");
+ LogPrintf("Recreating banlist.dat\n");
SetBannedSetDirty(true); // force write
DumpBanlist();
}
diff --git a/src/net.cpp b/src/net.cpp
index 533815b755..d9571e7036 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2389,7 +2389,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
LogPrintf("Loaded %i addresses from peers.dat %dms\n", addrman.size(), GetTimeMillis() - nStart);
else {
addrman.Clear(); // Addrman can be in an inconsistent state after failure, reset it
- LogPrintf("Invalid or missing peers.dat; recreating\n");
+ LogPrintf("Recreating peers.dat\n");
DumpAddresses();
}
}