Merge #6194: refactor: initialize variables in the header instead

3e788edae2 fmt: run `clang-format` (pasta)
cc3b63d69e 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 3e788edae2

Tree-SHA512: 568adae0a4af675d7ba34356ee9f62374ec1dd1be7515231ee7cae41fc21a3d72b0e9f6d8ab2f9ba10aa70e967e1358d065931a23cffcca0f0801260151bf942
This commit is contained in:
pasta 2024-08-20 15:30:43 -05:00
commit c8734e27c4
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
2 changed files with 13 additions and 38 deletions

View File

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

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;