refactor: initialize variables in the header instead

This commit is contained in:
pasta 2024-08-11 15:28:29 +07:00
parent efe4c2d6eb
commit cc3b63d69e
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
2 changed files with 11 additions and 37 deletions

View File

@ -22,21 +22,7 @@
#include <string>
CGovernanceObject::CGovernanceObject() :
cs(),
m_obj{},
nDeletionTime(0),
fCachedLocalValidity(false),
strLocalValidityError(),
fCachedFunding(false),
fCachedValid(true),
fCachedDelete(false),
fCachedEndorsed(false),
fDirtyCache(true),
fExpired(false),
fUnparsable(false),
mapCurrentMNVotes(),
fileVotes()
CGovernanceObject::CGovernanceObject()
{
// PARSE JSON DATA STORAGE (VCHDATA)
LoadData();
@ -44,19 +30,7 @@ CGovernanceObject::CGovernanceObject() :
CGovernanceObject::CGovernanceObject(const uint256& nHashParentIn, int nRevisionIn, int64_t nTimeIn, const uint256& nCollateralHashIn, const std::string& strDataHexIn) :
cs(),
m_obj{nHashParentIn, nRevisionIn, nTimeIn, nCollateralHashIn, strDataHexIn},
nDeletionTime(0),
fCachedLocalValidity(false),
strLocalValidityError(),
fCachedFunding(false),
fCachedValid(true),
fCachedDelete(false),
fCachedEndorsed(false),
fDirtyCache(true),
fExpired(false),
fUnparsable(false),
mapCurrentMNVotes(),
fileVotes()
m_obj{nHashParentIn, nRevisionIn, nTimeIn, nCollateralHashIn, strDataHexIn}
{
// PARSE JSON DATA STORAGE (VCHDATA)
LoadData();

View File

@ -103,37 +103,37 @@ private:
Governance::Object m_obj;
/// time this object was marked for deletion
int64_t nDeletionTime;
int64_t nDeletionTime{0};
/// is valid by blockchain
bool fCachedLocalValidity;
bool fCachedLocalValidity{false};
std::string strLocalValidityError;
// VARIOUS FLAGS FOR OBJECT / SET VIA MASTERNODE VOTING
/// true == minimum network support has been reached for this object to be funded (doesn't mean it will for sure though)
bool fCachedFunding;
bool fCachedFunding{false};
/// true == minimum network has been reached flagging this object as a valid and understood governance object (e.g, the serialized data is correct format, etc)
bool fCachedValid;
bool fCachedValid{true};
/// true == minimum network support has been reached saying this object should be deleted from the system entirely
bool fCachedDelete;
bool fCachedDelete{false};
/** true == minimum network support has been reached flagging this object as endorsed by an elected representative body
* (e.g. business review board / technical review board /etc)
*/
bool fCachedEndorsed;
bool fCachedEndorsed{false};
/// object was updated and cached values should be updated soon
bool fDirtyCache;
bool fDirtyCache{true};
/// Object is no longer of interest
bool fExpired;
bool fExpired{false};
/// Failed to parse object data
bool fUnparsable;
bool fUnparsable{false};
vote_m_t mapCurrentMNVotes;