Browse Source

[Fix] RPC Asset Chain - getblockchaininfo

pull/4/head
Capital Technologies & Research 6 years ago
committed by GitHub
parent
commit
c435e32afe
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/rpcblockchain.cpp

10
src/rpcblockchain.cpp

@ -1297,14 +1297,20 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
);
LOCK(cs_main);
double progress;
if ( ASSETCHAINS_SYMBOL[0] == 0 ) {
progress = Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), chainActive.LastTip());
} else {
int32_t longestchain = komodo_longestchain();
progress = (longestchain > 0 ) ? (double) chainActive.Height() / longestchain : 1.0;
}
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("chain", Params().NetworkIDString()));
obj.push_back(Pair("blocks", (int)chainActive.Height()));
obj.push_back(Pair("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1));
obj.push_back(Pair("bestblockhash", chainActive.LastTip()->GetBlockHash().GetHex()));
obj.push_back(Pair("difficulty", (double)GetNetworkDifficulty()));
obj.push_back(Pair("verificationprogress", Checkpoints::GuessVerificationProgress(Params().Checkpoints(), chainActive.LastTip())));
obj.push_back(Pair("verificationprogress", progress));
obj.push_back(Pair("chainwork", chainActive.LastTip()->nChainWork.GetHex()));
obj.push_back(Pair("pruned", fPruneMode));

Loading…
Cancel
Save