message: Add UpdateHashProof function
diff: @@ -3666,6 +3666,45 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, const Co
  return true;
  }
  +static bool UpdateHashProof(const CBlock& block, CValidationState& state, const Consensus::Params& consensusParams, CBlockIndex* pindex)
  +{
  + int nHeight = pindex->nHeight;
  + uint256 hash = block.GetHash();
  +
  + //reject proof of work at height consensusParams.nLastPOWBlock
  + if (block.IsProofOfWork() && nHeight > consensusParams.nLastPOWBlock)
  + return state.DoS(100, error("AcceptBlock() : reject proof-of-work at height %d", nHeight));
  +
  + // Check coinstake timestamp
  + if (block.IsProofOfStake() && !CheckCoinStakeTimestamp(block.GetBlockTime(), block.vtx[1]->nTime))
  + return state.DoS(50, error("AcceptBlock() : coinstake timestamp violation nTimeBlock=%d nTimeTx=%u", block.GetBlockTime(), block.vtx[1]->nTime));
  +
  + // Check proof-of-work or proof-of-stake
  + if (block.nBits != GetNextWorkRequired(pindex->pprev, &block, consensusParams))
  + return state.DoS(100, error("AcceptBlock() : incorrect %s", block.IsProofOfWork() ? "proof-of-work" : "proof-of-stake"));
  +
  + uint256 hashProof;
  + // Verify hash target and signature of coinstake tx
  + if (block.IsProofOfStake())
  + {
  + uint256 targetProofOfStake;
  + if (!CheckProofOfStake(pindex->pprev, state, *block.vtx[1], block.nBits, hashProof, targetProofOfStake))
  + {
  + return error("AcceptBlock() : check proof-of-stake failed for block %s", hash.ToString());
  + }
  + }
  +
  + // PoW is checked in CheckBlock()
  + if (block.IsProofOfWork())
  + {
  + hashProof = block.GetHash();
  + }
  +
  + // Record proof hash value
  + pindex->hashProof = hashProof;
  + return true;
  +}
  +
  static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex)
  {
  AssertLockHeld(cs_main);
  