|
|
@ -2766,7 +2766,7 @@ FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (pos.IsNull())
|
|
|
|
if (pos.IsNull())
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
boost::filesystem::path path = GetDataDir() / "blocks" / strprintf("%s%05u.dat", prefix, pos.nFile);
|
|
|
|
boost::filesystem::path path = GetBlockPosFilename(pos, prefix);
|
|
|
|
boost::filesystem::create_directories(path.parent_path());
|
|
|
|
boost::filesystem::create_directories(path.parent_path());
|
|
|
|
FILE* file = fopen(path.string().c_str(), "rb+");
|
|
|
|
FILE* file = fopen(path.string().c_str(), "rb+");
|
|
|
|
if (!file && !fReadOnly)
|
|
|
|
if (!file && !fReadOnly)
|
|
|
@ -2793,6 +2793,12 @@ FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly) {
|
|
|
|
return OpenDiskFile(pos, "rev", fReadOnly);
|
|
|
|
return OpenDiskFile(pos, "rev", fReadOnly);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boost::filesystem::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
boost::filesystem::path path = GetDataDir() / "blocks" / strprintf("%s%05u.dat", prefix, pos.nFile);
|
|
|
|
|
|
|
|
return path;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CBlockIndex * InsertBlockIndex(uint256 hash)
|
|
|
|
CBlockIndex * InsertBlockIndex(uint256 hash)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (hash == 0)
|
|
|
|
if (hash == 0)
|
|
|
|