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

Method GetBlockTrust

src/chain.cpp:73–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72
73uint256 CBlockIndex::GetBlockTrust() const
74{
75 uint256 bnTarget;
76 bnTarget.SetCompact(nBits);
77 if (bnTarget <= 0)
78 return 0;
79
80 if (IsProofOfStake()) {
81 // Return trust score as usual
82 return (uint256(1) << 256) / (bnTarget + 1);
83 } else {
84 // Calculate work amount for block
85 uint256 bnPoWTrust = ((~uint256(0) >> 20) / (bnTarget + 1));
86 return bnPoWTrust > 1 ? bnPoWTrust : 1;
87 }
88}

Callers 1

AddToBlockIndexFunction · 0.80

Calls 1

uint256Class · 0.70

Tested by

no test coverage detected