@@ -38,7 +38,9 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
3838{
3939 if (!m_govman.IsValid ()) return std::nullopt ;
4040 if (!m_mn_sync.IsSynced ()) return std::nullopt ;
41- if (nHeight % Params ().GetConsensus ().nSuperblockCycle < Params ().GetConsensus ().nSuperblockCycle - Params ().GetConsensus ().nSuperblockMaturityWindow ) return std::nullopt ;
41+ if (nHeight % Params ().GetConsensus ().nSuperblockCycle <
42+ Params ().GetConsensus ().nSuperblockCycle - Params ().GetConsensus ().nSuperblockMaturityWindow )
43+ return std::nullopt ;
4244 if (HasAlreadyVotedFundingTrigger ()) return std::nullopt ;
4345
4446 const auto approvedProposals = m_govman.GetApprovedProposals (m_dmnman.GetListAtChainTip ());
@@ -52,7 +54,8 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
5254 int nNextSuperblock;
5355
5456 CSuperblock::GetNearestSuperblocksHeights (nHeight, nLastSuperblock, nNextSuperblock);
55- auto SBEpochTime = static_cast <int64_t >(GetTime<std::chrono::seconds>().count () + (nNextSuperblock - nHeight) * 2.62 * 60 );
57+ auto SBEpochTime = static_cast <int64_t >(GetTime<std::chrono::seconds>().count () +
58+ (nNextSuperblock - nHeight) * 2.62 * 60 );
5659 auto governanceBudget = CSuperblock::GetPaymentsLimit (m_chainman.ActiveChain (), nNextSuperblock);
5760
5861 CAmount budgetAllocated{};
@@ -66,9 +69,8 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
6669 CAmount nAmount{};
6770 try {
6871 nAmount = ParsePaymentAmount (jproposal[" payment_amount" ].getValStr ());
69- }
70- catch (const std::runtime_error& e) {
71- LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d Skipping payment exception:%s\n " , __func__,nHeight, e.what ());
72+ } catch (const std::runtime_error& e) {
73+ LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d Skipping payment exception:%s\n " , __func__, nHeight, e.what ());
7274 continue ;
7375 }
7476
@@ -84,11 +86,12 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
8486
8587 // Skip proposals if the SB isn't within the proposal time window
8688 if (SBEpochTime < windowStart) {
87- LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d SB:%d windowStart:%d\n " , __func__,nHeight, SBEpochTime, windowStart);
89+ LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d SB:%d windowStart:%d\n " , __func__, nHeight, SBEpochTime,
90+ windowStart);
8891 continue ;
8992 }
9093 if (SBEpochTime > windowEnd) {
91- LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d SB:%d windowEnd:%d\n " , __func__,nHeight, SBEpochTime, windowEnd);
94+ LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d SB:%d windowEnd:%d\n " , __func__, nHeight, SBEpochTime, windowEnd);
9295 continue ;
9396 }
9497
@@ -119,7 +122,7 @@ std::optional<const CGovernanceObject> GovernanceSigner::CreateGovernanceTrigger
119122 // no sb_opt, no trigger
120123 if (!sb_opt.has_value ()) return std::nullopt ;
121124
122- // TODO: Check if nHashParentIn, nRevision and nCollateralHashIn are correct
125+ // TODO: Check if nHashParentIn, nRevision and nCollateralHashIn are correct
123126 LOCK (::cs_main);
124127
125128 // Check if identical trigger (equal DataHash()) is already created (signed by other masternode)
@@ -130,7 +133,7 @@ std::optional<const CGovernanceObject> GovernanceSigner::CreateGovernanceTrigger
130133 }
131134
132135 // Nobody submitted a trigger we'd like to see, so let's do it but only if we are the payee
133- const CBlockIndex * tip = WITH_LOCK (::cs_main, return m_chainman.ActiveChain ().Tip ());
136+ const CBlockIndex* tip = WITH_LOCK (::cs_main, return m_chainman.ActiveChain ().Tip ());
134137 const auto mnList = m_dmnman.GetListForBlock (tip);
135138 const auto mn_payees = mnList.GetProjectedMNPayees (tip);
136139
@@ -152,7 +155,8 @@ std::optional<const CGovernanceObject> GovernanceSigner::CreateGovernanceTrigger
152155 }
153156
154157 if (!m_govman.MasternodeRateCheck (gov_sb)) {
155- LogPrint (BCLog::GOBJECT, " %s -- Trigger rejected because of rate check failure hash(%s)\n " , __func__, gov_sb.GetHash ().ToString ());
158+ LogPrint (BCLog::GOBJECT, " %s -- Trigger rejected because of rate check failure hash(%s)\n " , __func__,
159+ gov_sb.GetHash ().ToString ());
156160 return std::nullopt ;
157161 }
158162
@@ -213,21 +217,23 @@ void GovernanceSigner::VoteGovernanceTriggers(const std::optional<const CGoverna
213217 const uint256 trigger_hash = govobj->GetHash ();
214218 if (trigger->GetBlockHeight () <= m_govman.GetCachedBlockHeight ()) {
215219 // ignore triggers from the past
216- LogPrint (BCLog::GOBJECT, " %s -- Not voting NO-FUNDING for outdated trigger:%s\n " , __func__, trigger_hash.ToString ());
220+ LogPrint (BCLog::GOBJECT, " %s -- Not voting NO-FUNDING for outdated trigger:%s\n " , __func__,
221+ trigger_hash.ToString ());
217222 continue ;
218223 }
219224 if (trigger_hash == votedFundingYesTriggerHash) {
220225 // Skip actual trigger
221- LogPrint (BCLog::GOBJECT, " %s -- Not voting NO-FUNDING for trigger:%s, we voted yes for it already\n " , __func__, trigger_hash.ToString ());
226+ LogPrint (BCLog::GOBJECT, " %s -- Not voting NO-FUNDING for trigger:%s, we voted yes for it already\n " ,
227+ __func__, trigger_hash.ToString ());
222228 continue ;
223229 }
224230 if (vote_rec_t voteRecord; govobj->GetCurrentMNVotes (m_mn_activeman.GetOutPoint (), voteRecord)) {
225231 const auto & strFunc = __func__;
226232 if (ranges::any_of (voteRecord.mapInstances , [&](const auto & voteInstancePair) {
227233 if (voteInstancePair.first == VOTE_SIGNAL_FUNDING) {
228234 LogPrint (BCLog::GOBJECT, /* Continued */
229- " %s -- Not voting NO-FUNDING for trigger:%s, we voted %s for it already\n " ,
230- strFunc, trigger_hash.ToString (),
235+ " %s -- Not voting NO-FUNDING for trigger:%s, we voted %s for it already\n " , strFunc,
236+ trigger_hash.ToString (),
231237 CGovernanceVoting::ConvertOutcomeToString (voteInstancePair.second .eOutcome ));
232238 return true ;
233239 }
@@ -253,7 +259,8 @@ bool GovernanceSigner::VoteFundingTrigger(const uint256& nHash, const vote_outco
253259
254260 CGovernanceException exception;
255261 if (!m_govman.ProcessVoteAndRelay (vote, exception, m_connman)) {
256- LogPrint (BCLog::GOBJECT, " %s -- Vote FUNDING %d for trigger:%s failed:%s\n " , __func__, outcome, nHash.ToString (), exception.what ());
262+ LogPrint (BCLog::GOBJECT, " %s -- Vote FUNDING %d for trigger:%s failed:%s\n " , __func__, outcome,
263+ nHash.ToString (), exception.what ());
257264 return false ;
258265 }
259266
0 commit comments