| 29 | #include "chainparamsseeds.h" |
| 30 | |
| 31 | bool CheckProof(uint256 hash, unsigned int nBits) |
| 32 | { |
| 33 | bool fNegative; |
| 34 | bool fOverflow; |
| 35 | uint256 bnTarget; |
| 36 | |
| 37 | |
| 38 | bnTarget.SetCompact(nBits, &fNegative, &fOverflow); |
| 39 | |
| 40 | // Check range |
| 41 | if (fNegative || bnTarget == 0 || fOverflow) |
| 42 | return false; //error("CheckProofOfWork() : nBits below minimum work"); |
| 43 | |
| 44 | // Check proof of work matches claimed amount |
| 45 | if (hash > bnTarget) |
| 46 | return false; //error("CheckProofOfWork() : hash doesn't match nBits"); |
| 47 | |
| 48 | return true; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Main network |