Skip to content

Commit

Permalink
refactor: use explicit std::shared_ptr instead of type alias (dashpay…
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta authored Mar 11, 2022
1 parent 52ddf5c commit 515011a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ void CDeterministicMNList::AddMN(const CDeterministicMNCPtr& dmn, bool fBumpTota
}
}

void CDeterministicMNList::UpdateMN(const CDeterministicMN& oldDmn, const CDeterministicMNStateCPtr& pdmnState)
void CDeterministicMNList::UpdateMN(const CDeterministicMN& oldDmn, const std::shared_ptr<const CDeterministicMNState>& pdmnState)
{
auto dmn = std::make_shared<CDeterministicMN>(oldDmn);
auto oldState = dmn->pdmnState;
Expand Down Expand Up @@ -474,7 +474,7 @@ void CDeterministicMNList::UpdateMN(const CDeterministicMN& oldDmn, const CDeter
mnMap = mnMap.set(oldDmn.proTxHash, dmn);
}

void CDeterministicMNList::UpdateMN(const uint256& proTxHash, const CDeterministicMNStateCPtr& pdmnState)
void CDeterministicMNList::UpdateMN(const uint256& proTxHash, const std::shared_ptr<const CDeterministicMNState>& pdmnState)
{
auto oldDmn = mnMap.find(proTxHash);
if (!oldDmn) {
Expand Down
8 changes: 4 additions & 4 deletions src/evo/deterministicmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CDeterministicMN
uint256 proTxHash;
COutPoint collateralOutpoint;
uint16_t nOperatorReward{0};
CDeterministicMNStateCPtr pdmnState;
std::shared_ptr<const CDeterministicMNState> pdmnState;

template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, bool oldFormat)
Expand Down Expand Up @@ -340,8 +340,8 @@ class CDeterministicMNList
CDeterministicMNList ApplyDiff(const CBlockIndex* pindex, const CDeterministicMNListDiff& diff) const;

void AddMN(const CDeterministicMNCPtr& dmn, bool fBumpTotalCount = true);
void UpdateMN(const CDeterministicMN& oldDmn, const CDeterministicMNStateCPtr& pdmnState);
void UpdateMN(const uint256& proTxHash, const CDeterministicMNStateCPtr& pdmnState);
void UpdateMN(const CDeterministicMN& oldDmn, const std::shared_ptr<const CDeterministicMNState>& pdmnState);
void UpdateMN(const uint256& proTxHash, const std::shared_ptr<const CDeterministicMNState>& pdmnState);
void UpdateMN(const CDeterministicMN& oldDmn, const CDeterministicMNStateDiff& stateDiff);
void RemoveMN(const uint256& proTxHash);

Expand Down Expand Up @@ -482,7 +482,7 @@ class CDeterministicMNListDiff_OldFormat
uint256 blockHash;
int nHeight{-1};
std::map<uint256, CDeterministicMNCPtr> addedMNs;
std::map<uint256, CDeterministicMNStateCPtr> updatedMNs;
std::map<uint256, std::shared_ptr<const CDeterministicMNState>> updatedMNs;
std::set<uint256> removedMns;

template<typename Stream>
Expand Down
5 changes: 0 additions & 5 deletions src/evo/dmnstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ class UniValue;

class CDeterministicMNState;

using CDeterministicMNStatePtr = std::shared_ptr<CDeterministicMNState>;
using CDeterministicMNStateCPtr = std::shared_ptr<const CDeterministicMNState>;

namespace llmq
{
class CFinalCommitment;
Expand Down Expand Up @@ -131,8 +128,6 @@ class CDeterministicMNState
std::string ToString() const;
void ToJson(UniValue& obj) const;
};
using CDeterministicMNStatePtr = std::shared_ptr<CDeterministicMNState>;
using CDeterministicMNStateCPtr = std::shared_ptr<const CDeterministicMNState>;

class CDeterministicMNStateDiff
{
Expand Down

0 comments on commit 515011a

Please sign in to comment.