2018-04-07 21:43:25 -07:00
|
|
|
// Copyright (c) 2018 The Bitcoin Private developers
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#ifndef BTCP_FORK_H
|
|
|
|
#define BTCP_FORK_H
|
|
|
|
|
2018-05-17 06:15:28 -07:00
|
|
|
#include <consensus/validation.h>
|
|
|
|
#include <primitives/block.h>
|
|
|
|
|
2018-04-07 21:43:25 -07:00
|
|
|
static const uint256 forkExtraHashSentinel = uint256S("f0f0f0f0fafafafaffffffffffffffffffffffffffffffffafafafaf0f0f0f0f");
|
2018-05-17 06:15:28 -07:00
|
|
|
static constexpr unsigned int FORK_CB_PER_BLOCK = 10000;
|
2018-04-07 21:43:25 -07:00
|
|
|
|
|
|
|
inline bool isForkBlock(int nHeight, int forkStartHeight, int forkHeightRange)
|
|
|
|
{
|
|
|
|
return (nHeight > forkStartHeight && nHeight <= forkStartHeight + forkHeightRange);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool looksLikeForkBlockHeader(const CBlockHeader& header)
|
|
|
|
{
|
|
|
|
return header.hashReserved == forkExtraHashSentinel;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool isForkEnabled(int nHeight, int forkStartHeight)
|
|
|
|
{
|
|
|
|
return nHeight > forkStartHeight;
|
|
|
|
}
|
|
|
|
|
2018-05-17 06:15:28 -07:00
|
|
|
bool ContextualCheckBlockFork(const CBlock& block, CValidationState& state,
|
2018-07-21 12:17:40 -07:00
|
|
|
const CChainParams& chainparams, const CBlockIndex* pindex);
|
2018-05-17 06:15:28 -07:00
|
|
|
|
|
|
|
std::string GetUTXOFileName(int);
|
|
|
|
|
2018-04-07 21:43:25 -07:00
|
|
|
#endif
|