aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-09-16 03:15:11 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-09-16 03:21:21 +0200
commit765f3984364bfd9647efa5f3e978cf203a7c5183 (patch)
tree2a97acaa13580c855549154f42f2f9e952443b63 /src/main.cpp
parent327dcfece7e13ceaeafbf29785e3076dbf6f1d28 (diff)
parentf7e36370f36ca806076cdcf0cd3ed0c35fd38c42 (diff)
downloadbitcoin-765f3984364bfd9647efa5f3e978cf203a7c5183.tar.xz
Merge pull request #4875
f7e3637 Eliminate extra assignment (Suhas Daftuar) ec7eb0f When reindexing check for file before trying to open (refactored) (Suhas Daftuar)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 1b746a0b08..90f4e48af0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -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)