Skip to content

Commit 2adce1f

Browse files
committed
Merge pull request #5385
57be955 Remove -printblock, -printblocktree, and -printblockindex (Pieter Wuille)
2 parents faa1623 + 57be955 commit 2adce1f

File tree

3 files changed

+0
-101
lines changed

3 files changed

+0
-101
lines changed

src/init.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,6 @@ std::string HelpMessage(HelpMessageMode mode)
330330
strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n";
331331
if (GetBoolArg("-help-debug", false))
332332
{
333-
strUsage += " -printblock=<hash> " + _("Print block on startup, if found in block index") + "\n";
334-
strUsage += " -printblocktree " + strprintf(_("Print block tree on startup (default: %u)"), 0) + "\n";
335333
strUsage += " -printpriority " + strprintf(_("Log transaction priority and fee per kB when mining blocks (default: %u)"), 0) + "\n";
336334
strUsage += " -privdb " + strprintf(_("Sets the DB_PRIVATE flag in the wallet db environment (default: %u)"), 1) + "\n";
337335
strUsage += " -regtest " + _("Enter regression test mode, which uses a special chain in which blocks can be solved instantly.") + "\n";
@@ -1048,34 +1046,6 @@ bool AppInit2(boost::thread_group& threadGroup)
10481046
}
10491047
LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart);
10501048

1051-
if (GetBoolArg("-printblockindex", false) || GetBoolArg("-printblocktree", false))
1052-
{
1053-
PrintBlockTree();
1054-
return false;
1055-
}
1056-
1057-
if (mapArgs.count("-printblock"))
1058-
{
1059-
string strMatch = mapArgs["-printblock"];
1060-
int nFound = 0;
1061-
for (BlockMap::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
1062-
{
1063-
uint256 hash = (*mi).first;
1064-
if (boost::algorithm::starts_with(hash.ToString(), strMatch))
1065-
{
1066-
CBlockIndex* pindex = (*mi).second;
1067-
CBlock block;
1068-
ReadBlockFromDisk(block, pindex);
1069-
block.BuildMerkleTree();
1070-
LogPrintf("%s\n", block.ToString());
1071-
nFound++;
1072-
}
1073-
}
1074-
if (nFound == 0)
1075-
LogPrintf("No blocks matching %s were found\n", strMatch);
1076-
return false;
1077-
}
1078-
10791049
boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
10801050
CAutoFile est_filein(fopen(est_path.string().c_str(), "rb"), SER_DISK, CLIENT_VERSION);
10811051
// Allowed to fail as this file IS missing on first startup.

src/main.cpp

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,75 +3113,6 @@ bool InitBlockIndex() {
31133113

31143114

31153115

3116-
void PrintBlockTree()
3117-
{
3118-
AssertLockHeld(cs_main);
3119-
// pre-compute tree structure
3120-
map<CBlockIndex*, vector<CBlockIndex*> > mapNext;
3121-
for (BlockMap::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
3122-
{
3123-
CBlockIndex* pindex = (*mi).second;
3124-
mapNext[pindex->pprev].push_back(pindex);
3125-
// test
3126-
//while (rand() % 3 == 0)
3127-
// mapNext[pindex->pprev].push_back(pindex);
3128-
}
3129-
3130-
vector<pair<int, CBlockIndex*> > vStack;
3131-
vStack.push_back(make_pair(0, chainActive.Genesis()));
3132-
3133-
int nPrevCol = 0;
3134-
while (!vStack.empty())
3135-
{
3136-
int nCol = vStack.back().first;
3137-
CBlockIndex* pindex = vStack.back().second;
3138-
vStack.pop_back();
3139-
3140-
// print split or gap
3141-
if (nCol > nPrevCol)
3142-
{
3143-
for (int i = 0; i < nCol-1; i++)
3144-
LogPrintf("| ");
3145-
LogPrintf("|\\\n");
3146-
}
3147-
else if (nCol < nPrevCol)
3148-
{
3149-
for (int i = 0; i < nCol; i++)
3150-
LogPrintf("| ");
3151-
LogPrintf("|\n");
3152-
}
3153-
nPrevCol = nCol;
3154-
3155-
// print columns
3156-
for (int i = 0; i < nCol; i++)
3157-
LogPrintf("| ");
3158-
3159-
// print item
3160-
CBlock block;
3161-
ReadBlockFromDisk(block, pindex);
3162-
LogPrintf("%d (blk%05u.dat:0x%x) %s tx %u\n",
3163-
pindex->nHeight,
3164-
pindex->GetBlockPos().nFile, pindex->GetBlockPos().nPos,
3165-
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()),
3166-
block.vtx.size());
3167-
3168-
// put the main time-chain first
3169-
vector<CBlockIndex*>& vNext = mapNext[pindex];
3170-
for (unsigned int i = 0; i < vNext.size(); i++)
3171-
{
3172-
if (chainActive.Next(vNext[i]))
3173-
{
3174-
swap(vNext[0], vNext[i]);
3175-
break;
3176-
}
3177-
}
3178-
3179-
// iterate children
3180-
for (unsigned int i = 0; i < vNext.size(); i++)
3181-
vStack.push_back(make_pair(nCol+i, vNext[i]));
3182-
}
3183-
}
3184-
31853116
bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
31863117
{
31873118
// Map of disk positions for blocks with unknown parent (only used for reindex)

src/main.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ bool InitBlockIndex();
177177
bool LoadBlockIndex();
178178
/** Unload database information */
179179
void UnloadBlockIndex();
180-
/** Print the loaded block tree */
181-
void PrintBlockTree();
182180
/** Process protocol messages received from a given node */
183181
bool ProcessMessages(CNode* pfrom);
184182
/** Send queued protocol messages to be sent to a give node */

0 commit comments

Comments
 (0)