diff --git a/src/chainparams.cpp b/src/chainparams.cpp --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -143,6 +143,9 @@ // Aug, 1 hard fork consensus.uahfHeight = 478559; + // Nov, 13 hard fork + consensus.cashHardForkActivationTime = 1510600000; + /** * The message start string is designed to be unlikely to occur in * normal data. The characters are rarely used upper ASCII, not valid as @@ -312,6 +315,9 @@ // Aug, 1 hard fork consensus.uahfHeight = 1155876; + // Nov, 13 hard fork + consensus.cashHardForkActivationTime = 1510600000; + pchMessageStart[0] = 0x0b; pchMessageStart[1] = 0x11; pchMessageStart[2] = 0x09; @@ -431,6 +437,9 @@ // Hard fork is always enabled on regtest. consensus.uahfHeight = 0; + // Nov, 13 hard fork + consensus.cashHardForkActivationTime = 0; + pchMessageStart[0] = 0xfa; pchMessageStart[1] = 0xbf; pchMessageStart[2] = 0xb5; diff --git a/src/consensus/params.h b/src/consensus/params.h --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -73,6 +73,9 @@ } uint256 nMinimumChainWork; uint256 defaultAssumeValid; + + /** Activation time at which the cash HF kicks in. */ + int64_t cashHardForkActivationTime; }; } // namespace Consensus diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -374,6 +374,9 @@ /** Check is UAHF has activated. */ bool IsUAHFenabled(const Config &config, const CBlockIndex *pindexPrev); +/** Check is Cash HF has activated. */ +bool IsCashHFEnabled(const Config &config, const CBlockIndex *pindexPrev); + /** (try to) add transaction to memory pool * plTxnReplaced will be appended to with all transactions replaced from mempool * **/ diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -617,6 +617,19 @@ return IsUAHFenabled(config, pindexPrev->nHeight); } +static bool IsCashHFEnabled(const Config &config, int64_t nMedianTimePast) { + return nMedianTimePast >= + config.GetChainParams().GetConsensus().cashHardForkActivationTime; +} + +bool IsCashHFEnabled(const Config &config, const CBlockIndex *pindexPrev) { + if (pindexPrev == nullptr) { + return false; + } + + return IsCashHFEnabled(config, pindexPrev->GetMedianTimePast()); +} + // Used to avoid mempool polluting consensus critical paths if CCoinsViewMempool // were somehow broken and returning the wrong scriptPubKeys static bool CheckInputsFromMempoolAndCache(const CTransaction &tx,