diff --git a/src/masternodes/govvariables/attributes.cpp b/src/masternodes/govvariables/attributes.cpp index ddaae3a7f4..4456d5010d 100644 --- a/src/masternodes/govvariables/attributes.cpp +++ b/src/masternodes/govvariables/attributes.cpp @@ -182,6 +182,5 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const Res ATTRIBUTES::Apply(CCustomCSView & mnview, const uint32_t height) { - mnview.SetAttributes(attributes); return Res::Ok(); } diff --git a/src/masternodes/gv.cpp b/src/masternodes/gv.cpp index a9198af926..4f4b907741 100644 --- a/src/masternodes/gv.cpp +++ b/src/masternodes/gv.cpp @@ -81,3 +81,12 @@ void CGovView::EraseStoredVariables(const uint32_t height) EraseBy(GovVarKey{height, var->GetName()}); } } + +std::map CGovView::GetAttributes() const { + if (const auto var = GetVariable("ATTRIBUTES")) { + if (const auto attrs = dynamic_cast(var.get())) { + return attrs->attributes; + } + } + return {}; +} diff --git a/src/masternodes/gv.h b/src/masternodes/gv.h index bc3717bf48..8994722b47 100644 --- a/src/masternodes/gv.h +++ b/src/masternodes/gv.h @@ -46,6 +46,8 @@ class CGovView : public virtual CStorageView std::map>> GetAllStoredVariables(); void EraseStoredVariables(const uint32_t height); + std::map GetAttributes() const; + struct ByHeightVars { static constexpr uint8_t prefix() { return 'G'; } }; struct ByName { static constexpr uint8_t prefix() { return 'g'; } }; }; diff --git a/src/masternodes/masternodes.cpp b/src/masternodes/masternodes.cpp index cf6cacf7e3..811d811f93 100644 --- a/src/masternodes/masternodes.cpp +++ b/src/masternodes/masternodes.cpp @@ -544,16 +544,6 @@ uint16_t CMasternodesView::GetTimelock(const uint256& nodeId, const CMasternode& return 0; } -std::map CMasternodesView::GetAttributes() const { - std::map attributes; - Read(Attrs::prefix(), attributes); - return attributes; -} - -void CMasternodesView::SetAttributes(const std::map& attributes) { - Write(Attrs::prefix(), attributes); -} - std::vector CMasternodesView::GetBlockTimes(const CKeyID& keyID, const uint32_t blockHeight, const int32_t creationHeight, const uint16_t timelock) { // Get last block time for non-subnode staking diff --git a/src/masternodes/masternodes.h b/src/masternodes/masternodes.h index f2cccd09ef..50623bc3f0 100644 --- a/src/masternodes/masternodes.h +++ b/src/masternodes/masternodes.h @@ -222,9 +222,6 @@ class CMasternodesView : public virtual CStorageView uint16_t GetTimelock(const uint256& nodeId, const CMasternode& node, const uint64_t height) const; - std::map GetAttributes() const; - void SetAttributes(const std::map& attributes); - // tags struct ID { static constexpr uint8_t prefix() { return 'M'; } }; struct Operator { static constexpr uint8_t prefix() { return 'o'; } }; @@ -236,9 +233,6 @@ class CMasternodesView : public virtual CStorageView // Store long term time lock struct Timelock { static constexpr uint8_t prefix() { return 'K'; } }; - - // Store attributes map - struct Attrs { static constexpr uint8_t prefix() { return 's'; } }; }; class CLastHeightView : public virtual CStorageView @@ -363,7 +357,7 @@ class CCustomCSView void CheckPrefixes() { CheckPrefix< - CMasternodesView :: ID, Operator, Owner, Staker, SubNode, Timelock, Attrs, + CMasternodesView :: ID, Operator, Owner, Staker, SubNode, Timelock, CLastHeightView :: Height, CTeamView :: AuthTeam, ConfirmTeam, CurrentTeam, CFoundationsDebtView :: Debt,