Skip to content

Commit 4b183d3

Browse files
author
Marko Bencun
committed
Remove block file location upgrade code
An effort to reduce the size of AppInitMain(). The removed code upgrades the location of the block files when upgrading to 0.8. 0.8 seems to be the oldest version still in use.
1 parent 5628c70 commit 4b183d3

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

src/init.cpp

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,32 +1353,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
13531353
fReindex = GetBoolArg("-reindex", false);
13541354
bool fReindexChainState = GetBoolArg("-reindex-chainstate", false);
13551355

1356-
// Upgrading to 0.8; hard-link the old blknnnn.dat files into /blocks/
1357-
boost::filesystem::path blocksDir = GetDataDir() / "blocks";
1358-
if (!boost::filesystem::exists(blocksDir))
1359-
{
1360-
boost::filesystem::create_directories(blocksDir);
1361-
bool linked = false;
1362-
for (unsigned int i = 1; i < 10000; i++) {
1363-
boost::filesystem::path source = GetDataDir() / strprintf("blk%04u.dat", i);
1364-
if (!boost::filesystem::exists(source)) break;
1365-
boost::filesystem::path dest = blocksDir / strprintf("blk%05u.dat", i-1);
1366-
try {
1367-
boost::filesystem::create_hard_link(source, dest);
1368-
LogPrintf("Hardlinked %s -> %s\n", source.string(), dest.string());
1369-
linked = true;
1370-
} catch (const boost::filesystem::filesystem_error& e) {
1371-
// Note: hardlink creation failing is not a disaster, it just means
1372-
// blocks will get re-downloaded from peers.
1373-
LogPrintf("Error hardlinking blk%04u.dat: %s\n", i, e.what());
1374-
break;
1375-
}
1376-
}
1377-
if (linked)
1378-
{
1379-
fReindex = true;
1380-
}
1381-
}
1356+
boost::filesystem::create_directories(GetDataDir() / "blocks");
13821357

13831358
// cache size calculations
13841359
int64_t nTotalCache = (GetArg("-dbcache", nDefaultDbCache) << 20);

0 commit comments

Comments
 (0)