| 71 | |
| 72 | |
| 73 | uint256 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 | } |
no test coverage detected