Skip to content

Commit 1b2e555

Browse files
committed
add autoprune information to RPC "getblockchaininfo"
1 parent 1623f6e commit 1b2e555

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/rpcblockchain.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,15 @@ Value getblockchaininfo(const Array& params, bool fHelp)
492492
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
493493
obj.push_back(Pair("verificationprogress", Checkpoints::GuessVerificationProgress(chainActive.Tip())));
494494
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex()));
495+
obj.push_back(Pair("pruned", fPruneMode));
496+
if (fPruneMode)
497+
{
498+
CBlockIndex *block = chainActive.Tip();
499+
while (block && block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA))
500+
block = block->pprev;
501+
502+
obj.push_back(Pair("pruneheight", block->nHeight));
503+
}
495504
return obj;
496505
}
497506

0 commit comments

Comments
 (0)