message: Update AcceptBlock with checks for coinstake
diff: @@ -3787,6 +3787,26 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
  if (!AcceptBlockHeader(block, state, chainparams, &pindex))
  return false;
  + if (!UpdateHashProof(block, state, chainparams.GetConsensus(), pindex))
  + {
  + return error("%s: UpdateHashProof(): %s", __func__, state.GetRejectReason().c_str());
  + }
  +
  + int nHeight = pindex->nHeight;
  +
  + if (block.IsProofOfWork() && nHeight > chainparams.GetConsensus().nLastPOWBlock)
  + return state.DoS(100, error("AcceptBlock() : reject proof-of-work at height %d", nHeight));
  +
  + // Check that the block satisfies synchronized checkpoint
  + if (!Checkpoints::CheckSync(nHeight))
  + return error("AcceptBlock() : rejected by synchronized checkpoint");
  +
  + // Enforce rule that the coinbase starts with serialized block height
  + CScript expect = CScript() << nHeight;
  + if (block.vtx[0]->vin[0].scriptSig.size() < expect.size() ||
  + !std::equal(expect.begin(), expect.end(), block.vtx[0]->vin[0].scriptSig.begin()))
  + return state.DoS(100, error("AcceptBlock() : block height mismatch in coinbase"));
  +
  // Try to process all requested blocks that we don't have, but only
  // process an unrequested block if it's new and has enough work to
  // advance our tip, and isn't too many blocks ahead.
  @@ -3828,8 +3848,6 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
  if (!IsInitialBlockDownload() && chainActive.Tip() == pindex->pprev)
  GetMainSignals().NewPoWValidBlock(pindex, pblock);
  - int nHeight = pindex->nHeight;
  -
  // Write block to history file
  try {
  unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
  