aboutsummaryrefslogtreecommitdiff
path: root/src/addrdb.cpp
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2024-03-12 09:39:07 +0000
committerfanquake <fanquake@gmail.com>2024-03-12 10:05:06 +0000
commit31be1a47675e4449f856e61beb2b4bfc228ea219 (patch)
treed9ead51b2f7dce87ab4e903730a177b0b274d1ef /src/addrdb.cpp
parente70590988a7b19aca2e3cc2c91d067347b1915ec (diff)
parentfa391513949b7a3b56321436e2015c7e9e6dac2b (diff)
downloadbitcoin-31be1a47675e4449f856e61beb2b4bfc228ea219.tar.xz
Merge bitcoin/bitcoin#29236: log: Nuke error(...)
fa391513949b7a3b56321436e2015c7e9e6dac2b refactor: Remove unused error() (MarcoFalke) fad0335517096f435d76adce7833e213d3cc23d1 scripted-diff: Replace error() with LogError() (MarcoFalke) fa808fb74972637840675e310f6d4a0f06028d61 refactor: Make error() return type void (MarcoFalke) fa1d62434843866d242bff9f9c55cb838a4f0d83 scripted-diff: return error(...); ==> error(...); return false; (MarcoFalke) fa9a5e80ab86c997102a1c3d4ba017bbe86641d5 refactor: Add missing {} around error() calls (MarcoFalke) Pull request description: `error(...)` has many issues: * It is often used in the context of `return error(...)`, implying that it has a "fancy" type, creating confusion with `util::Result/Error` * `-logsourcelocations` does not work with it, because it will pretend the error happened inside of `logging.h` * The log line contains `ERROR: `, as opposed to `[error]`, like for other errors logged with `LogError`. Fix all issues by removing it. ACKs for top commit: fjahr: re-utACK fa391513949b7a3b56321436e2015c7e9e6dac2b stickies-v: re-ACK fa391513949b7a3b56321436e2015c7e9e6dac2b, no changes since 4a903741b0 ryanofsky: Code review ACK fa391513949b7a3b56321436e2015c7e9e6dac2b. Just rebase since last review Tree-SHA512: ec5bb502ab0d3733fdb14a8a00762638fce0417afd8dd6294ae0d485ce2b7ca5b1efeb50fc2cd7467f6c652e4ed3e99b0f283b08aeca04bbfb7ea4f2c95d283a
Diffstat (limited to 'src/addrdb.cpp')
-rw-r--r--src/addrdb.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/addrdb.cpp b/src/addrdb.cpp
index 3f5916560e..f8d4240f3f 100644
--- a/src/addrdb.cpp
+++ b/src/addrdb.cpp
@@ -44,7 +44,8 @@ bool SerializeDB(Stream& stream, const Data& data)
hashwriter << Params().MessageStart() << data;
stream << hashwriter.GetHash();
} catch (const std::exception& e) {
- return error("%s: Serialize or I/O error - %s", __func__, e.what());
+ LogError("%s: Serialize or I/O error - %s\n", __func__, e.what());
+ return false;
}
return true;
@@ -64,7 +65,8 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data
if (fileout.IsNull()) {
fileout.fclose();
remove(pathTmp);
- return error("%s: Failed to open file %s", __func__, fs::PathToString(pathTmp));
+ LogError("%s: Failed to open file %s\n", __func__, fs::PathToString(pathTmp));
+ return false;
}
// Serialize
@@ -76,14 +78,16 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data
if (!FileCommit(fileout.Get())) {
fileout.fclose();
remove(pathTmp);
- return error("%s: Failed to flush file %s", __func__, fs::PathToString(pathTmp));
+ LogError("%s: Failed to flush file %s\n", __func__, fs::PathToString(pathTmp));
+ return false;
}
fileout.fclose();
// replace existing file, if any, with new file
if (!RenameOver(pathTmp, path)) {
remove(pathTmp);
- return error("%s: Rename-into-place failed", __func__);
+ LogError("%s: Rename-into-place failed\n", __func__);
+ return false;
}
return true;
@@ -140,7 +144,7 @@ bool CBanDB::Write(const banmap_t& banSet)
}
for (const auto& err : errors) {
- error("%s", err);
+ LogError("%s\n", err);
}
return false;
}