refactor: use explicit std::shared_ptr instead of type alias (#4720)

This commit is contained in:
PastaPastaPasta 2022-03-11 13:40:31 -06:00 committed by GitHub
parent 52ddf5c453
commit 515011aaa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 11 deletions

View File

@ -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;
@ -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) {

View File

@ -59,7 +59,7 @@ public:
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)
@ -340,8 +340,8 @@ public:
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);
@ -482,7 +482,7 @@ public:
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>

View File

@ -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;
@ -131,8 +128,6 @@ public:
std::string ToString() const;
void ToJson(UniValue& obj) const;
};
using CDeterministicMNStatePtr = std::shared_ptr<CDeterministicMNState>;
using CDeterministicMNStateCPtr = std::shared_ptr<const CDeterministicMNState>;
class CDeterministicMNStateDiff
{