Check a proof-of-work Raises CheckProofOfWorkError
(hash, nBits)
| 820 | pass |
| 821 | |
| 822 | def CheckProofOfWork(hash, nBits): |
| 823 | """Check a proof-of-work |
| 824 | |
| 825 | Raises CheckProofOfWorkError |
| 826 | """ |
| 827 | target = uint256_from_compact(nBits) |
| 828 | |
| 829 | # Check range |
| 830 | if not (0 < target <= coreparams.PROOF_OF_WORK_LIMIT): |
| 831 | raise CheckProofOfWorkError("CheckProofOfWork() : nBits below minimum work") |
| 832 | |
| 833 | # Check proof of work matches claimed amount |
| 834 | hash = uint256_from_str(hash) |
| 835 | if hash > target: |
| 836 | raise CheckProofOfWorkError("CheckProofOfWork() : hash doesn't match nBits") |
| 837 | |
| 838 | |
| 839 | def CheckBlockHeader(block_header, fCheckPoW = True, cur_time=None): |
no test coverage detected