Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 1,326 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 0) { | ||||
"connecting the tip to the main chain\n" | "connecting the tip to the main chain\n" | ||||
" \"status\": \"xxxx\" (string) status of the chain " | " \"status\": \"xxxx\" (string) status of the chain " | ||||
"(active, valid-fork, valid-headers, headers-only, invalid)\n" | "(active, valid-fork, valid-headers, headers-only, invalid)\n" | ||||
" }\n" | " }\n" | ||||
"]\n" | "]\n" | ||||
"Possible values for status:\n" | "Possible values for status:\n" | ||||
"1. \"invalid\" This branch contains at least one " | "1. \"invalid\" This branch contains at least one " | ||||
"invalid block\n" | "invalid block\n" | ||||
"2. \"headers-only\" Not all blocks for this branch are " | "2. \"parked\" This branch contains at least one " | ||||
"parked block\n" | |||||
"3. \"headers-only\" Not all blocks for this branch are " | |||||
"available, but the headers are valid\n" | "available, but the headers are valid\n" | ||||
"3. \"valid-headers\" All blocks are available for this " | "4. \"valid-headers\" All blocks are available for this " | ||||
"branch, but they were never fully validated\n" | "branch, but they were never fully validated\n" | ||||
"4. \"valid-fork\" This branch is not part of the " | "5. \"valid-fork\" This branch is not part of the " | ||||
"active chain, but is fully validated\n" | "active chain, but is fully validated\n" | ||||
"5. \"active\" This is the tip of the active main " | "6. \"active\" This is the tip of the active main " | ||||
"chain, which is certainly valid\n" | "chain, which is certainly valid\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getchaintips", "") + | HelpExampleCli("getchaintips", "") + | ||||
HelpExampleRpc("getchaintips", "")); | HelpExampleRpc("getchaintips", "")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | for (const CBlockIndex *block : setTips) { | ||||
std::string status; | std::string status; | ||||
if (chainActive.Contains(block)) { | if (chainActive.Contains(block)) { | ||||
// This block is part of the currently active chain. | // This block is part of the currently active chain. | ||||
status = "active"; | status = "active"; | ||||
} else if (block->nStatus.isInvalid()) { | } else if (block->nStatus.isInvalid()) { | ||||
// This block or one of its ancestors is invalid. | // This block or one of its ancestors is invalid. | ||||
status = "invalid"; | status = "invalid"; | ||||
} else if (block->nStatus.isOnParkedChain()) { | |||||
// This block or one of its ancestors is parked. | |||||
status = "parked"; | |||||
} else if (block->nChainTx == 0) { | } else if (block->nChainTx == 0) { | ||||
// This block cannot be connected because full block data for it or | // This block cannot be connected because full block data for it or | ||||
// one of its parents is missing. | // one of its parents is missing. | ||||
status = "headers-only"; | status = "headers-only"; | ||||
} else if (block->IsValid(BlockValidity::SCRIPTS)) { | } else if (block->IsValid(BlockValidity::SCRIPTS)) { | ||||
// This block is fully validated, but no longer part of the active | // This block is fully validated, but no longer part of the active | ||||
// chain. It was probably the active block once, but was | // chain. It was probably the active block once, but was | ||||
// reorganized. | // reorganized. | ||||
▲ Show 20 Lines • Show All 393 Lines • Show Last 20 Lines |