Changeset View
Changeset View
Standalone View
Standalone View
src/addrdb.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | bool SerializeFileDB(const CChainParams &chainParams, const std::string &prefix, | ||||
if (fileout.IsNull()) { | if (fileout.IsNull()) { | ||||
return error("%s: Failed to open file %s", __func__, pathTmp.string()); | return error("%s: Failed to open file %s", __func__, pathTmp.string()); | ||||
} | } | ||||
// Serialize | // Serialize | ||||
if (!SerializeDB(chainParams, fileout, data)) { | if (!SerializeDB(chainParams, fileout, data)) { | ||||
return false; | return false; | ||||
} | } | ||||
FileCommit(fileout.Get()); | if (!FileCommit(fileout.Get())) { | ||||
return error("%s: Failed to flush file %s", __func__, pathTmp.string()); | |||||
} | |||||
fileout.fclose(); | fileout.fclose(); | ||||
// replace existing file, if any, with new file | // replace existing file, if any, with new file | ||||
if (!RenameOver(pathTmp, path)) { | if (!RenameOver(pathTmp, path)) { | ||||
return error("%s: Rename-into-place failed", __func__); | return error("%s: Rename-into-place failed", __func__); | ||||
} | } | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |