From b9a92853fe0b127cf1734e35153842437a8a682f Mon Sep 17 00:00:00 2001 From: jouzo Date: Mon, 30 Jan 2023 18:48:34 +0100 Subject: [PATCH] Revert "Add undo in ReversGeneralCoinbaseTx() (#1641)" This reverts commit 9283f6f33a209aba6b7fa606c56a41713b0ba8b6. --- src/validation.cpp | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index 34001b5e4c0..e74189971c2 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2223,34 +2223,23 @@ void ReverseGeneralCoinbaseTx(CCustomCSView & mnview, int height, const Consensu // Remove Loan and Options balances from Unallocated if ((height < Params().GetConsensus().FortCanningHeight && kv.first == CommunityAccountType::Loan) || - (height < consensus.GrandCentralHeight && kv.first == CommunityAccountType::Options)) + kv.first == CommunityAccountType::Options) { mnview.SubCommunityBalance(CommunityAccountType::Unallocated, subsidy); } else { - if (height >= consensus.GrandCentralHeight) + if (height >= consensus.GrandCentralHeight && kv.first == CommunityAccountType::CommunityDevFunds) { - const auto attributes = mnview.GetAttributes(); - assert(attributes); - - if (kv.first == CommunityAccountType::CommunityDevFunds) { - CDataStructureV0 enabledKey{AttributeTypes::Param, ParamIDs::Feature, DFIPKeys::GovernanceEnabled}; - - if (!attributes->GetValue(enabledKey, false)) - { - mnview.SubBalance(consensus.foundationShareScript, {DCT_ID{0}, subsidy}); + CDataStructureV0 enabledKey{AttributeTypes::Param, ParamIDs::Feature, DFIPKeys::GovernanceEnabled}; - continue; - } - } else if (kv.first == CommunityAccountType::Unallocated || kv.first == CommunityAccountType::Options) { - CDataStructureV0 enabledKey{AttributeTypes::Param, ParamIDs::Feature, DFIPKeys::EmissionUnusedFund}; - - if (attributes->GetValue(enabledKey, false)) { - mnview.SubBalance(consensus.unusedEmission, {DCT_ID{0}, subsidy}); - } else { - mnview.SubCommunityBalance(CommunityAccountType::Unallocated, subsidy); - } + auto attributes = mnview.GetAttributes(); + if (!attributes) { + return; + } + if (!attributes->GetValue(enabledKey, false)) + { + mnview.SubBalance(consensus.foundationShareScript, {DCT_ID{0}, subsidy}); continue; }