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

Function GetBlockProofEquivalentTime

src/pow.cpp:157–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& from, const CBlockIndex& tip, const Consensus::Params& params)
158{
159 arith_uint256 r;
160 int sign = 1;
161 if (to.nChainWork > from.nChainWork) {
162 r = to.nChainWork - from.nChainWork;
163 } else {
164 r = from.nChainWork - to.nChainWork;
165 sign = -1;
166 }
167 r = r * arith_uint256(params.nPowTargetSpacing) / GetBlockProof(tip);
168 if (r.bits() > 63) {
169 return sign * std::numeric_limits<int64_t>::max();
170 }
171 return sign * r.GetLow64();
172}

Callers 2

canSendMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 4

GetBlockProofFunction · 0.85
bitsMethod · 0.80
GetLow64Method · 0.80
arith_uint256Class · 0.70

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68