Skip to content

Commit 78effb3

Browse files
author
MarcoFalke
committed
Merge #21222: log: Clarify log message when file does not exist
faf48f2 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 faf48f2 amitiuttarwar: utACK faf48f2, 👍 for consistency. also checked where we create / load other `.dat` files, looks good to me. practicalswift: cr ACK faf48f2 Tree-SHA512: 697a728ef2b9f203363ac00b03eaf23ddf80bee043ecd3719265a0d884e8cfe88cd39afe946c86ab849edd1c836f05ec51125f052bdc14fe184b84447567756f
2 parents 84f6c69 + faf48f2 commit 78effb3

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/addrdb.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ template <typename Data>
109109
bool DeserializeFileDB(const fs::path& path, Data& data)
110110
{
111111
// open input file, and associate with CAutoFile
112-
FILE *file = fsbridge::fopen(path, "rb");
112+
FILE* file = fsbridge::fopen(path, "rb");
113113
CAutoFile filein(file, SER_DISK, CLIENT_VERSION);
114-
if (filein.IsNull())
115-
return error("%s: Failed to open file %s", __func__, path.string());
116-
114+
if (filein.IsNull()) {
115+
LogPrintf("Missing or invalid file %s\n", path.string());
116+
return false;
117+
}
117118
return DeserializeDB(filein, data);
118119
}
119-
120-
}
120+
} // namespace
121121

122122
CBanDB::CBanDB(fs::path ban_list_path) : m_ban_list_path(std::move(ban_list_path))
123123
{

src/banman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t
2828
LogPrint(BCLog::NET, "Loaded %d banned node ips/subnets from banlist.dat %dms\n",
2929
m_banned.size(), GetTimeMillis() - n_start);
3030
} else {
31-
LogPrintf("Invalid or missing banlist.dat; recreating\n");
31+
LogPrintf("Recreating banlist.dat\n");
3232
SetBannedSetDirty(true); // force write
3333
DumpBanlist();
3434
}

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2389,7 +2389,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
23892389
LogPrintf("Loaded %i addresses from peers.dat %dms\n", addrman.size(), GetTimeMillis() - nStart);
23902390
else {
23912391
addrman.Clear(); // Addrman can be in an inconsistent state after failure, reset it
2392-
LogPrintf("Invalid or missing peers.dat; recreating\n");
2392+
LogPrintf("Recreating peers.dat\n");
23932393
DumpAddresses();
23942394
}
23952395
}

0 commit comments

Comments
 (0)