Skip to content

Commit 2378a99

Browse files
committed
trivial: tidy-up governance/object.h
Needed to make the next commit easier to follow.
1 parent f077ca3 commit 2378a99

File tree

1 file changed

+26
-82
lines changed

1 file changed

+26
-82
lines changed

src/governance/object.h

Lines changed: 26 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ class CGovernanceObject
9797
/// time this object was marked for deletion
9898
int64_t nDeletionTime{0};
9999

100-
101100
/// is valid by blockchain
102101
bool fCachedLocalValidity{false};
103102
std::string strLocalValidityError;
@@ -133,99 +132,45 @@ class CGovernanceObject
133132

134133
public:
135134
CGovernanceObject();
136-
137135
CGovernanceObject(const uint256& nHashParentIn, int nRevisionIn, int64_t nTime, const uint256& nCollateralHashIn, const std::string& strDataHexIn);
138-
139136
CGovernanceObject(const CGovernanceObject& other);
140137

141-
// Public Getter methods
142-
143-
const Governance::Object& Object() const
144-
{
145-
return m_obj;
146-
}
147-
148-
int64_t GetCreationTime() const
149-
{
150-
return m_obj.time;
151-
}
152-
153-
int64_t GetDeletionTime() const
154-
{
155-
return nDeletionTime;
156-
}
157-
158-
GovernanceObject GetObjectType() const
159-
{
160-
return m_obj.type;
161-
}
162-
163-
const uint256& GetCollateralHash() const
164-
{
165-
return m_obj.collateralHash;
166-
}
167-
168-
const COutPoint& GetMasternodeOutpoint() const
169-
{
170-
return m_obj.masternodeOutpoint;
171-
}
172-
173-
bool IsSetCachedFunding() const
174-
{
175-
return fCachedFunding;
176-
}
177-
178-
bool IsSetCachedValid() const
179-
{
180-
return fCachedValid;
181-
}
182-
183-
bool IsSetCachedDelete() const
184-
{
185-
return fCachedDelete;
186-
}
187-
188-
bool IsSetCachedEndorsed() const
189-
{
190-
return fCachedEndorsed;
191-
}
192-
193-
bool IsSetDirtyCache() const
194-
{
195-
return fDirtyCache;
196-
}
197-
198-
bool IsSetExpired() const
199-
{
200-
return fExpired;
201-
}
202-
203-
void SetExpired()
204-
{
205-
fExpired = true;
206-
}
207-
208-
const CGovernanceObjectVoteFile& GetVoteFile() const
209-
{
210-
return fileVotes;
211-
}
212-
213-
// Signature related functions
214-
138+
// Getters
139+
bool IsSetCachedFunding() const { return fCachedFunding; }
140+
bool IsSetCachedValid() const { return fCachedValid; }
141+
bool IsSetCachedDelete() const { return fCachedDelete; }
142+
bool IsSetCachedEndorsed() const { return fCachedEndorsed; }
143+
bool IsSetDirtyCache() const { return fDirtyCache; }
144+
bool IsSetExpired() const { return fExpired; }
145+
GovernanceObject GetObjectType() const { return m_obj.type; }
146+
int64_t GetCreationTime() const { return m_obj.time; }
147+
int64_t GetDeletionTime() const { return nDeletionTime; }
148+
149+
const CGovernanceObjectVoteFile& GetVoteFile() const { return fileVotes; }
150+
const COutPoint& GetMasternodeOutpoint() const { return m_obj.masternodeOutpoint; }
151+
const Governance::Object& Object() const { return m_obj; }
152+
const uint256& GetCollateralHash() const { return m_obj.collateralHash; }
153+
154+
// Setters
155+
void SetExpired() { fExpired = true; }
215156
void SetMasternodeOutpoint(const COutPoint& outpoint);
216157
void SetSignature(Span<const uint8_t> sig);
217-
bool CheckSignature(const CBLSPublicKey& pubKey) const;
218158

159+
// Signature related functions
160+
bool CheckSignature(const CBLSPublicKey& pubKey) const;
219161
uint256 GetSignatureHash() const;
220162

221163
// CORE OBJECT FUNCTIONS
222164

223-
bool IsValidLocally(const CDeterministicMNList& tip_mn_list, const ChainstateManager& chainman, std::string& strError, bool fCheckCollateral) const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
165+
bool IsValidLocally(const CDeterministicMNList& tip_mn_list, const ChainstateManager& chainman, std::string& strError, bool fCheckCollateral) const
166+
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
224167

225-
bool IsValidLocally(const CDeterministicMNList& tip_mn_list, const ChainstateManager& chainman, std::string& strError, bool& fMissingConfirmations, bool fCheckCollateral) const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
168+
bool IsValidLocally(const CDeterministicMNList& tip_mn_list, const ChainstateManager& chainman, std::string& strError, bool& fMissingConfirmations, bool fCheckCollateral) const
169+
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
226170

227171
/// Check the collateral transaction for the budget proposal/finalized budget
228-
bool IsCollateralValid(const ChainstateManager& chainman, std::string& strError, bool& fMissingConfirmations) const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
172+
bool IsCollateralValid(const ChainstateManager& chainman, std::string& strError, bool& fMissingConfirmations) const
173+
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
229174

230175
void UpdateLocalValidity(const CDeterministicMNList& tip_mn_list, const ChainstateManager& chainman)
231176
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
@@ -297,5 +242,4 @@ class CGovernanceObject
297242
std::set<uint256> RemoveInvalidVotes(const CDeterministicMNList& tip_mn_list, const COutPoint& mnOutpoint);
298243
};
299244

300-
301245
#endif // BITCOIN_GOVERNANCE_OBJECT_H

0 commit comments

Comments
 (0)