@@ -38,7 +38,9 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
38
38
{
39
39
if (!m_govman.IsValid ()) return std::nullopt ;
40
40
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 ;
42
44
if (HasAlreadyVotedFundingTrigger ()) return std::nullopt ;
43
45
44
46
const auto approvedProposals = m_govman.GetApprovedProposals (m_dmnman.GetListAtChainTip ());
@@ -52,7 +54,8 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
52
54
int nNextSuperblock;
53
55
54
56
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 );
56
59
auto governanceBudget = CSuperblock::GetPaymentsLimit (m_chainman.ActiveChain (), nNextSuperblock);
57
60
58
61
CAmount budgetAllocated{};
@@ -66,9 +69,8 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
66
69
CAmount nAmount{};
67
70
try {
68
71
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 ());
72
74
continue ;
73
75
}
74
76
@@ -84,11 +86,12 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
84
86
85
87
// Skip proposals if the SB isn't within the proposal time window
86
88
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);
88
91
continue ;
89
92
}
90
93
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);
92
95
continue ;
93
96
}
94
97
@@ -119,7 +122,7 @@ std::optional<const CGovernanceObject> GovernanceSigner::CreateGovernanceTrigger
119
122
// no sb_opt, no trigger
120
123
if (!sb_opt.has_value ()) return std::nullopt ;
121
124
122
- // TODO: Check if nHashParentIn, nRevision and nCollateralHashIn are correct
125
+ // TODO: Check if nHashParentIn, nRevision and nCollateralHashIn are correct
123
126
LOCK (::cs_main);
124
127
125
128
// Check if identical trigger (equal DataHash()) is already created (signed by other masternode)
@@ -130,7 +133,7 @@ std::optional<const CGovernanceObject> GovernanceSigner::CreateGovernanceTrigger
130
133
}
131
134
132
135
// 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 ());
134
137
const auto mnList = m_dmnman.GetListForBlock (tip);
135
138
const auto mn_payees = mnList.GetProjectedMNPayees (tip);
136
139
@@ -152,7 +155,8 @@ std::optional<const CGovernanceObject> GovernanceSigner::CreateGovernanceTrigger
152
155
}
153
156
154
157
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 ());
156
160
return std::nullopt ;
157
161
}
158
162
@@ -213,21 +217,23 @@ void GovernanceSigner::VoteGovernanceTriggers(const std::optional<const CGoverna
213
217
const uint256 trigger_hash = govobj->GetHash ();
214
218
if (trigger->GetBlockHeight () <= m_govman.GetCachedBlockHeight ()) {
215
219
// 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 ());
217
222
continue ;
218
223
}
219
224
if (trigger_hash == votedFundingYesTriggerHash) {
220
225
// 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 ());
222
228
continue ;
223
229
}
224
230
if (vote_rec_t voteRecord; govobj->GetCurrentMNVotes (m_mn_activeman.GetOutPoint (), voteRecord)) {
225
231
const auto & strFunc = __func__;
226
232
if (ranges::any_of (voteRecord.mapInstances , [&](const auto & voteInstancePair) {
227
233
if (voteInstancePair.first == VOTE_SIGNAL_FUNDING) {
228
234
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 (),
231
237
CGovernanceVoting::ConvertOutcomeToString (voteInstancePair.second .eOutcome ));
232
238
return true ;
233
239
}
@@ -253,7 +259,8 @@ bool GovernanceSigner::VoteFundingTrigger(const uint256& nHash, const vote_outco
253
259
254
260
CGovernanceException exception;
255
261
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 ());
257
264
return false ;
258
265
}
259
266
0 commit comments