MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetBlockProof

Function GetBlockProof

src/pow.cpp:93–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93uint256 GetBlockProof(const CBlockIndex& block)
94{
95 uint256 bnTarget;
96 bool fNegative;
97 bool fOverflow;
98 bnTarget.SetCompact(block.nBits, &fNegative, &fOverflow);
99 if (fNegative || fOverflow || bnTarget == 0)
100 return 0;
101 // We need to compute 2**256 / (bnTarget+1), but we can't represent 2**256
102 // as it's too large for a uint256. However, as 2**256 is at least as large
103 // as bnTarget+1, it is equal to ((2**256 - bnTarget - 1) / (bnTarget+1)) + 1,
104 // or ~bnTarget / (nTarget+1) + 1.
105 return (~bnTarget / (bnTarget + 1)) + 1;
106}

Callers 4

AddToBlockIndexFunction · 0.85
LoadBlockIndexDBFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected