MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / SoftForkMajorityDesc

Function SoftForkMajorityDesc

src/rpcblockchain.cpp:575–592  ·  view source on GitHub ↗

Implementation of IsSuperMajority with better feedback */

Source from the content-addressed store, hash-verified

573
574/** Implementation of IsSuperMajority with better feedback */
575UniValue SoftForkMajorityDesc(int minVersion, CBlockIndex* pindex, int nRequired, const Consensus::Params& consensusParams)
576{
577 int nFound = 0;
578 CBlockIndex* pstart = pindex;
579 for (int i = 0; i < consensusParams.nMajorityWindow && pstart != NULL; i++)
580 {
581 if (pstart->nVersion >= minVersion)
582 ++nFound;
583 pstart = pstart->pprev;
584 }
585
586 UniValue rv(UniValue::VOBJ);
587 rv.push_back(Pair("status", nFound >= nRequired));
588 rv.push_back(Pair("found", nFound));
589 rv.push_back(Pair("required", nRequired));
590 rv.push_back(Pair("window", consensusParams.nMajorityWindow));
591 return rv;
592}
593
594UniValue SoftForkDesc(const std::string &name, int version, CBlockIndex* pindex, const Consensus::Params& consensusParams)
595{

Callers 1

SoftForkDescFunction · 0.85

Calls 2

PairFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected