rolled version, added info to chaintips
This commit is contained in:
parent
96fdb05689
commit
8932d90a9e
2 changed files with 21 additions and 8 deletions
|
@ -3,7 +3,7 @@ AC_PREREQ([2.60])
|
||||||
define(_CLIENT_VERSION_MAJOR, 0)
|
define(_CLIENT_VERSION_MAJOR, 0)
|
||||||
define(_CLIENT_VERSION_MINOR, 17)
|
define(_CLIENT_VERSION_MINOR, 17)
|
||||||
define(_CLIENT_VERSION_REVISION, 3)
|
define(_CLIENT_VERSION_REVISION, 3)
|
||||||
define(_CLIENT_VERSION_BUILD, 0)
|
define(_CLIENT_VERSION_BUILD, 1)
|
||||||
define(_CLIENT_VERSION_IS_RELEASE, true)
|
define(_CLIENT_VERSION_IS_RELEASE, true)
|
||||||
define(_COPYRIGHT_YEAR, 2019)
|
define(_COPYRIGHT_YEAR, 2019)
|
||||||
define(_COPYRIGHT_HOLDERS,[The %s developers])
|
define(_COPYRIGHT_HOLDERS,[The %s developers])
|
||||||
|
|
|
@ -1310,16 +1310,18 @@ static UniValue getchaintips(const JSONRPCRequest& request)
|
||||||
"\nResult:\n"
|
"\nResult:\n"
|
||||||
"[\n"
|
"[\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" \"height\": xxxx, (numeric) height of the chain tip\n"
|
" \"height\": xxxx, (numeric) height of the chain tip\n"
|
||||||
" \"hash\": \"xxxx\", (string) block hash of the tip\n"
|
" \"hash\": \"xxxx\", (string) block hash of the tip\n"
|
||||||
" \"branchlen\": 0 (numeric) zero for main chain\n"
|
" \"branchlen\": 0 (numeric) zero for main chain\n"
|
||||||
" \"status\": \"active\" (string) \"active\" for the main chain\n"
|
" \"status\": \"active\" (string) \"active\" for the main chain\n"
|
||||||
" },\n"
|
" },\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" \"height\": xxxx,\n"
|
" \"height\": xxxx,\n"
|
||||||
" \"hash\": \"xxxx\",\n"
|
" \"hash\": \"xxxx\",\n"
|
||||||
" \"branchlen\": 1 (numeric) length of branch connecting the tip to the main chain\n"
|
" \"branchlen\": 1 (numeric) length of branch connecting the tip to the main chain\n"
|
||||||
" \"status\": \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\n"
|
" \"branchhash\": \"xxxx\", (string) hash of the historical block where we branched\n"
|
||||||
|
" \"branchhashNext\": \"xxxx\", (string) block hash of the first block down this chain\n"
|
||||||
|
" \"status\": \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
"Possible values for status:\n"
|
"Possible values for status:\n"
|
||||||
|
@ -1372,8 +1374,19 @@ static UniValue getchaintips(const JSONRPCRequest& request)
|
||||||
obj.pushKV("height", block->nHeight);
|
obj.pushKV("height", block->nHeight);
|
||||||
obj.pushKV("hash", block->phashBlock->GetHex());
|
obj.pushKV("hash", block->phashBlock->GetHex());
|
||||||
|
|
||||||
const int branchLen = block->nHeight - chainActive.FindFork(block)->nHeight;
|
// not use ForkAt method because we need the previous one as well
|
||||||
|
const CBlockIndex *forkAt = block, *forkPrev = block;
|
||||||
|
while (forkAt && !chainActive.Contains(forkAt)) {
|
||||||
|
forkPrev = forkAt;
|
||||||
|
forkAt = forkAt->pprev;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int branchLen = block->nHeight - forkAt->nHeight;
|
||||||
obj.pushKV("branchlen", branchLen);
|
obj.pushKV("branchlen", branchLen);
|
||||||
|
if (forkAt != forkPrev) {
|
||||||
|
obj.pushKV("branchhash", forkAt->phashBlock->GetHex());
|
||||||
|
obj.pushKV("branchhashNext", forkPrev->phashBlock->GetHex());
|
||||||
|
}
|
||||||
|
|
||||||
std::string status;
|
std::string status;
|
||||||
if (chainActive.Contains(block)) {
|
if (chainActive.Contains(block)) {
|
||||||
|
|
Loading…
Reference in a new issue