Skip to content

Commit

Permalink
Merge #6194: refactor: initialize variables in the header instead
Browse files Browse the repository at this point in the history
3e788ed fmt: run `clang-format` (pasta)
cc3b63d refactor: initialize variables in the header instead (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  Don't initialize via initializer lists when avoidable

  ## What was done?
  Initialize in the header

  ## How Has This Been Tested?
  building

  ## Breaking Changes
  None

  ## Checklist:
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK 3e788ed

Tree-SHA512: 568adae0a4af675d7ba34356ee9f62374ec1dd1be7515231ee7cae41fc21a3d72b0e9f6d8ab2f9ba10aa70e967e1358d065931a23cffcca0f0801260151bf942
  • Loading branch information
PastaPastaPasta committed Aug 20, 2024
2 parents f1e8452 + 3e788ed commit c8734e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 38 deletions.
33 changes: 4 additions & 29 deletions src/governance/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,16 @@

#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();
}

CGovernanceObject::CGovernanceObject(const uint256& nHashParentIn, int nRevisionIn, int64_t nTimeIn, const uint256& nCollateralHashIn, const std::string& strDataHexIn) :
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();
Expand Down
18 changes: 9 additions & 9 deletions src/governance/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,37 +103,37 @@ class CGovernanceObject
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;

Expand Down

0 comments on commit c8734e2

Please sign in to comment.