mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
fix: use proper pindex/pindex->pprev in credit pool code during v20/mn_rr activations
This commit is contained in:
parent
f3d2f2da26
commit
bacaa805ea
@ -218,16 +218,16 @@ CCreditPoolManager::CCreditPoolManager(CEvoDB& _evoDb)
|
||||
{
|
||||
}
|
||||
|
||||
CCreditPoolDiff::CCreditPoolDiff(CCreditPool starter, const CBlockIndex *pindex, const Consensus::Params& consensusParams, const CAmount blockSubsidy) :
|
||||
CCreditPoolDiff::CCreditPoolDiff(CCreditPool starter, const CBlockIndex *pindexPrev, const Consensus::Params& consensusParams, const CAmount blockSubsidy) :
|
||||
pool(std::move(starter)),
|
||||
pindex(pindex),
|
||||
pindexPrev(pindexPrev),
|
||||
params(consensusParams)
|
||||
{
|
||||
assert(pindex);
|
||||
assert(pindexPrev);
|
||||
|
||||
if (llmq::utils::IsMNRewardReallocationActive(pindex)) {
|
||||
if (llmq::utils::IsMNRewardReallocationActive(pindexPrev)) {
|
||||
// We consider V20 active if mn_rr is active
|
||||
platformReward = MasternodePayments::PlatformShare(GetMasternodePayment(pindex->nHeight, blockSubsidy, /*fV20Active=*/ true));
|
||||
platformReward = MasternodePayments::PlatformShare(GetMasternodePayment(pindexPrev->nHeight + 1, blockSubsidy, /*fV20Active=*/ true));
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ bool CCreditPoolDiff::ProcessLockUnlockTransaction(const CTransaction& tx, TxVal
|
||||
if (tx.nVersion != 3) return true;
|
||||
if (tx.nType != TRANSACTION_ASSET_LOCK && tx.nType != TRANSACTION_ASSET_UNLOCK) return true;
|
||||
|
||||
if (!CheckAssetLockUnlockTx(tx, pindex, pool.indexes, state)) {
|
||||
if (!CheckAssetLockUnlockTx(tx, pindexPrev, pool.indexes, state)) {
|
||||
// pass the state returned by the function above
|
||||
return false;
|
||||
}
|
||||
|
@ -70,10 +70,10 @@ private:
|
||||
CAmount sessionUnlocked{0};
|
||||
CAmount platformReward{0};
|
||||
|
||||
const CBlockIndex *pindex{nullptr};
|
||||
const CBlockIndex *pindexPrev{nullptr};
|
||||
const Consensus::Params& params;
|
||||
public:
|
||||
explicit CCreditPoolDiff(CCreditPool starter, const CBlockIndex *pindex,
|
||||
explicit CCreditPoolDiff(CCreditPool starter, const CBlockIndex *pindexPrev,
|
||||
const Consensus::Params& consensusParams,
|
||||
const CAmount blockSubsidy);
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <deploymentstatus.h>
|
||||
#include <evo/cbtx.h>
|
||||
#include <evo/creditpool.h>
|
||||
#include <evo/deterministicmns.h>
|
||||
@ -276,7 +277,7 @@ bool CheckCreditPoolDiffForBlock(const CBlock& block, const CBlockIndex* pindex,
|
||||
const CAmount blockSubsidy, BlockValidationState& state)
|
||||
{
|
||||
try {
|
||||
if (!llmq::utils::IsV20Active(pindex)) return true;
|
||||
if (!DeploymentActiveAt(*pindex, consensusParams, Consensus::DEPLOYMENT_V20)) return true;
|
||||
|
||||
auto creditPoolDiff = GetCreditPoolDiffForBlock(block, pindex->pprev, consensusParams, blockSubsidy, state);
|
||||
if (!creditPoolDiff.has_value()) return false;
|
||||
|
Loading…
Reference in New Issue
Block a user