diff --git a/src/dsnotificationinterface.cpp b/src/dsnotificationinterface.cpp index 88a90d76f..65f99b576 100644 --- a/src/dsnotificationinterface.cpp +++ b/src/dsnotificationinterface.cpp @@ -36,10 +36,16 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con instantsend.UpdatedBlockTip(pindexNew); mnpayments.UpdatedBlockTip(pindexNew); governance.UpdatedBlockTip(pindexNew); + + // DIP0001 updates + + // Update global flags + fDIP0001LockedInAtTip = (VersionBitsState(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_LOCKED_IN); + fDIP0001ActiveAtTip = (VersionBitsState(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_ACTIVE); } void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlock *pblock) { instantsend.SyncTransaction(tx, pblock); CPrivateSend::SyncTransaction(tx, pblock); -} \ No newline at end of file +} diff --git a/src/validation.cpp b/src/validation.cpp index a510e3da8..a313ea8bd 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -85,6 +85,9 @@ uint64_t nPruneTarget = 0; bool fAlerts = DEFAULT_ALERTS; bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT; +std::atomic fDIP0001LockedInAtTip{false}; +std::atomic fDIP0001ActiveAtTip{false}; + uint256 hashAssumeValid; /** Fees smaller than this (in duffs) are considered zero fee (for relaying, mining and transaction creation) */ @@ -2460,10 +2463,6 @@ void static UpdateTip(CBlockIndex *pindexNew) { } } } - - // Update global flags - fDIP0001LockedInAtTip = (VersionBitsTipState(chainParams.GetConsensus(), Consensus::DEPLOYMENT_DIP0001) == THRESHOLD_LOCKED_IN); - fDIP0001ActiveAtTip = (VersionBitsTipState(chainParams.GetConsensus(), Consensus::DEPLOYMENT_DIP0001) == THRESHOLD_ACTIVE); } /** Disconnect chainActive's tip. You probably want to call mempool.removeForReorg and manually re-limit mempool size after this, with cs_main held. */ diff --git a/src/validation.h b/src/validation.h index 795205863..8347b0754 100644 --- a/src/validation.h +++ b/src/validation.h @@ -47,9 +47,6 @@ class CValidationState; struct LockPoints; -static std::atomic fDIP0001LockedInAtTip{false}; -static std::atomic fDIP0001ActiveAtTip{false}; - /** Default for accepting alerts from the P2P network. */ static const bool DEFAULT_ALERTS = true; /** Default for DEFAULT_WHITELISTRELAY. */ @@ -164,6 +161,8 @@ extern bool fAlerts; extern bool fEnableReplacement; extern std::map mapRejectedBlocks; +extern std::atomic fDIP0001LockedInAtTip; +extern std::atomic fDIP0001ActiveAtTip; /** Block hash whose ancestors we will assume to have valid scripts without checking them. */ extern uint256 hashAssumeValid;