Vexta Core v0.3.1 release
Some checks failed
Vexta CI / Ubuntu build smoke test (push) Has been cancelled

This commit is contained in:
Capri 2026-11-15 20:44:09 +00:00
commit 997aaf5716
27 changed files with 508 additions and 118 deletions

View file

@ -137,6 +137,20 @@ double GetDifficulty(const CBlockIndex* blockindex)
return dDiff;
}
int GetRPCBlockAlgo(
const CBlockIndex* blockindex,
const Consensus::Params& consensusParams)
{
assert(blockindex != nullptr);
// Before RandomX activation every block used SHA256D consensus,
// regardless of historical version-rolling bits.
if (blockindex->nHeight < consensusParams.randomXActivationHeight)
return ALGO_SHA256D;
return blockindex->GetBlockHeader().GetAlgo();
}
double GetAlgoDifficulty(
const CBlockIndex* blockindex,
const Consensus::Params& consensusParams,
@ -234,16 +248,18 @@ UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex
result.pushKV("mediantime", (int64_t)blockindex->GetMedianTimePast());
result.pushKV("nonce", (uint64_t)blockindex->nNonce);
result.pushKV("bits", strprintf("%08x", blockindex->nBits));
result.pushKV("difficulty", GetDifficulty(blockindex));
result.pushKV("chainwork", blockindex->nChainWork.GetHex());
result.pushKV("nTx", (uint64_t)blockindex->nTx);
const Consensus::Params& consensusParams = Params().GetConsensus();
const CBlockHeader block = blockindex->GetBlockHeader();
const int algo =
blockindex->GetBlockHash() == consensusParams.hashGenesisBlock
? ALGO_SHA256D
: block.GetAlgo();
// Historical blocks before RandomX activation always used SHA256D,
// regardless of version-rolling bits in their block headers.
const int algo = GetRPCBlockAlgo(blockindex, consensusParams);
result.pushKV(
"difficulty",
GetAlgoDifficulty(blockindex, consensusParams, algo));
result.pushKV("pow_algo_id", algo);