mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
Merge pull request #4875
f7e3637Eliminate extra assignment (Suhas Daftuar)ec7eb0fWhen reindexing check for file before trying to open (refactored) (Suhas Daftuar)
This commit is contained in:
@@ -2795,7 +2795,7 @@ FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly)
|
||||
{
|
||||
if (pos.IsNull())
|
||||
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());
|
||||
FILE* file = fopen(path.string().c_str(), "rb+");
|
||||
if (!file && !fReadOnly)
|
||||
@@ -2822,6 +2822,11 @@ FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly) {
|
||||
return OpenDiskFile(pos, "rev", fReadOnly);
|
||||
}
|
||||
|
||||
boost::filesystem::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix)
|
||||
{
|
||||
return GetDataDir() / "blocks" / strprintf("%s%05u.dat", prefix, pos.nFile);
|
||||
}
|
||||
|
||||
CBlockIndex * InsertBlockIndex(uint256 hash)
|
||||
{
|
||||
if (hash == 0)
|
||||
|
||||
Reference in New Issue
Block a user