mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
refactor: drop dependency governance/classes on llmq/utils
This commit is contained in:
parent
c329615584
commit
8f3d3db9a4
@ -7,9 +7,9 @@
|
|||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <consensus/validation.h>
|
#include <consensus/validation.h>
|
||||||
#include <core_io.h>
|
#include <core_io.h>
|
||||||
|
#include <deploymentstatus.h>
|
||||||
#include <governance/governance.h>
|
#include <governance/governance.h>
|
||||||
#include <key_io.h>
|
#include <key_io.h>
|
||||||
#include <llmq/utils.h>
|
|
||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
#include <script/standard.h>
|
#include <script/standard.h>
|
||||||
#include <util/moneystr.h>
|
#include <util/moneystr.h>
|
||||||
@ -496,13 +496,13 @@ CAmount CSuperblock::GetPaymentsLimit(int nBlockHeight)
|
|||||||
const CBlockIndex* pindex = ::ChainActive().Tip();
|
const CBlockIndex* pindex = ::ChainActive().Tip();
|
||||||
if (pindex->nHeight > nBlockHeight) pindex = pindex->GetAncestor(nBlockHeight);
|
if (pindex->nHeight > nBlockHeight) pindex = pindex->GetAncestor(nBlockHeight);
|
||||||
|
|
||||||
const auto v20_state = llmq::utils::GetV20State(pindex);
|
const auto v20_state = g_versionbitscache.State(pindex, consensusParams, Consensus::DEPLOYMENT_V20);
|
||||||
bool fV20Active{v20_state == ThresholdState::ACTIVE};
|
bool fV20Active{v20_state == ThresholdState::ACTIVE};
|
||||||
if (!fV20Active && nBlockHeight > pindex->nHeight) {
|
if (!fV20Active && nBlockHeight > pindex->nHeight) {
|
||||||
// If fV20Active isn't active yet and nBlockHeight refers to a future SuperBlock
|
// If fV20Active isn't active yet and nBlockHeight refers to a future SuperBlock
|
||||||
// then we need to check if the fork is locked_in and see if it will be active by the time of the future SuperBlock
|
// then we need to check if the fork is locked_in and see if it will be active by the time of the future SuperBlock
|
||||||
if (v20_state == ThresholdState::LOCKED_IN) {
|
if (v20_state == ThresholdState::LOCKED_IN) {
|
||||||
int activation_height = llmq::utils::GetV20Since(pindex) + static_cast<int>(Params().GetConsensus().vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize);
|
int activation_height = g_versionbitscache.StateSinceHeight(pindex, consensusParams, Consensus::DEPLOYMENT_V20) + static_cast<int>(Params().GetConsensus().vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize);
|
||||||
if (nBlockHeight >= activation_height) {
|
if (nBlockHeight >= activation_height) {
|
||||||
fV20Active = true;
|
fV20Active = true;
|
||||||
}
|
}
|
||||||
|
@ -699,16 +699,6 @@ bool IsMNRewardReallocationActive(gsl::not_null<const CBlockIndex*> pindex)
|
|||||||
return llmq_versionbitscache.State(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_MN_RR) == ThresholdState::ACTIVE;
|
return llmq_versionbitscache.State(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_MN_RR) == ThresholdState::ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThresholdState GetV20State(gsl::not_null<const CBlockIndex*> pindex)
|
|
||||||
{
|
|
||||||
return llmq_versionbitscache.State(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_V20);
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetV20Since(gsl::not_null<const CBlockIndex*> pindex)
|
|
||||||
{
|
|
||||||
return llmq_versionbitscache.StateSinceHeight(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_V20);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint256 DeterministicOutboundConnection(const uint256& proTxHash1, const uint256& proTxHash2)
|
uint256 DeterministicOutboundConnection(const uint256& proTxHash1, const uint256& proTxHash2)
|
||||||
{
|
{
|
||||||
// We need to deterministically select who is going to initiate the connection. The naive way would be to simply
|
// We need to deterministically select who is going to initiate the connection. The naive way would be to simply
|
||||||
|
@ -83,10 +83,6 @@ bool IsV19Active(gsl::not_null<const CBlockIndex*> pindex);
|
|||||||
bool IsV20Active(gsl::not_null<const CBlockIndex*> pindex);
|
bool IsV20Active(gsl::not_null<const CBlockIndex*> pindex);
|
||||||
// TODO deployments
|
// TODO deployments
|
||||||
bool IsMNRewardReallocationActive(gsl::not_null<const CBlockIndex*> pindex);
|
bool IsMNRewardReallocationActive(gsl::not_null<const CBlockIndex*> pindex);
|
||||||
// TODO deployments
|
|
||||||
ThresholdState GetV20State(gsl::not_null<const CBlockIndex*> pindex);
|
|
||||||
// TODO deployments
|
|
||||||
int GetV20Since(gsl::not_null<const CBlockIndex*> pindex);
|
|
||||||
|
|
||||||
/// Returns the state of `-llmq-data-recovery`
|
/// Returns the state of `-llmq-data-recovery`
|
||||||
// TODO options
|
// TODO options
|
||||||
|
Loading…
Reference in New Issue
Block a user