| 224 | } |
| 225 | |
| 226 | bool CheckParentProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& params) |
| 227 | { |
| 228 | bool fNegative; |
| 229 | bool fOverflow; |
| 230 | arith_uint256 bnTarget; |
| 231 | |
| 232 | bnTarget.SetCompact(nBits, &fNegative, &fOverflow); |
| 233 | |
| 234 | // Check range |
| 235 | if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.parentChainPowLimit)) |
| 236 | return false; |
| 237 | |
| 238 | // Check proof of work matches claimed amount |
| 239 | if (UintToArith256(hash) > bnTarget) |
| 240 | return false; |
| 241 | |
| 242 | return true; |
| 243 | } |
| 244 | |
| 245 | bool IsValidPeginWitness(const CScriptWitness& pegin_witness, const std::vector<std::pair<CScript, CScript>>& fedpegscripts, const COutPoint& prevout, std::string& err_msg, bool check_depth, bool* depth_failed) { |
| 246 | if (depth_failed) { |
no test coverage detected