Skip to content

Commit 8eed793

Browse files
committed
Next HF activation code.
Summary: Fixed Nov, 13 so we are ready for whatever comes with 1x/2x . Test Plan: make check Reviewers: freetrader, dagurval, sickpig, #bitcoin_abc, schancel Reviewed By: #bitcoin_abc, schancel Subscribers: schancel Differential Revision: https://reviews.bitcoinabc.org/D612
1 parent 80455aa commit 8eed793

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

src/chainparams.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ class CMainParams : public CChainParams {
143143
// Aug, 1 hard fork
144144
consensus.uahfHeight = 478559;
145145

146+
// Nov, 13 hard fork
147+
consensus.cashHardForkActivationTime = 1510600000;
148+
146149
/**
147150
* The message start string is designed to be unlikely to occur in
148151
* normal data. The characters are rarely used upper ASCII, not valid as
@@ -312,6 +315,9 @@ class CTestNetParams : public CChainParams {
312315
// Aug, 1 hard fork
313316
consensus.uahfHeight = 1155876;
314317

318+
// Nov, 13 hard fork
319+
consensus.cashHardForkActivationTime = 1510600000;
320+
315321
pchMessageStart[0] = 0x0b;
316322
pchMessageStart[1] = 0x11;
317323
pchMessageStart[2] = 0x09;
@@ -431,6 +437,9 @@ class CRegTestParams : public CChainParams {
431437
// Hard fork is always enabled on regtest.
432438
consensus.uahfHeight = 0;
433439

440+
// Nov, 13 hard fork
441+
consensus.cashHardForkActivationTime = 0;
442+
434443
pchMessageStart[0] = 0xfa;
435444
pchMessageStart[1] = 0xbf;
436445
pchMessageStart[2] = 0xb5;

src/consensus/params.h

+3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ struct Params {
7373
}
7474
uint256 nMinimumChainWork;
7575
uint256 defaultAssumeValid;
76+
77+
/** Activation time at which the cash HF kicks in. */
78+
int64_t cashHardForkActivationTime;
7679
};
7780
} // namespace Consensus
7881

src/validation.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,19 @@ bool IsUAHFenabled(const Config &config, const CBlockIndex *pindexPrev) {
617617
return IsUAHFenabled(config, pindexPrev->nHeight);
618618
}
619619

620+
static bool IsCashHFEnabled(const Config &config, int64_t nMedianTimePast) {
621+
return nMedianTimePast >=
622+
config.GetChainParams().GetConsensus().cashHardForkActivationTime;
623+
}
624+
625+
bool IsCashHFEnabled(const Config &config, const CBlockIndex *pindexPrev) {
626+
if (pindexPrev == nullptr) {
627+
return false;
628+
}
629+
630+
return IsCashHFEnabled(config, pindexPrev->GetMedianTimePast());
631+
}
632+
620633
// Used to avoid mempool polluting consensus critical paths if CCoinsViewMempool
621634
// were somehow broken and returning the wrong scriptPubKeys
622635
static bool CheckInputsFromMempoolAndCache(const CTransaction &tx,

src/validation.h

+3
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ void PruneBlockFilesManual(int nPruneUpToHeight);
374374
/** Check is UAHF has activated. */
375375
bool IsUAHFenabled(const Config &config, const CBlockIndex *pindexPrev);
376376

377+
/** Check is Cash HF has activated. */
378+
bool IsCashHFEnabled(const Config &config, const CBlockIndex *pindexPrev);
379+
377380
/** (try to) add transaction to memory pool
378381
* plTxnReplaced will be appended to with all transactions replaced from mempool
379382
* **/

0 commit comments

Comments
 (0)