@@ -40,7 +40,9 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
40
40
{
41
41
if (!m_govman.IsValid ()) return std::nullopt ;
42
42
if (!m_mn_sync.IsSynced ()) return std::nullopt ;
43
- if (nHeight % Params ().GetConsensus ().nSuperblockCycle < Params ().GetConsensus ().nSuperblockCycle - Params ().GetConsensus ().nSuperblockMaturityWindow ) return std::nullopt ;
43
+ if (nHeight % Params ().GetConsensus ().nSuperblockCycle <
44
+ Params ().GetConsensus ().nSuperblockCycle - Params ().GetConsensus ().nSuperblockMaturityWindow )
45
+ return std::nullopt ;
44
46
if (HasAlreadyVotedFundingTrigger ()) return std::nullopt ;
45
47
46
48
const auto approvedProposals = m_govman.GetApprovedProposals (m_dmnman.GetListAtChainTip ());
@@ -54,7 +56,8 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
54
56
int nNextSuperblock;
55
57
56
58
CSuperblock::GetNearestSuperblocksHeights (nHeight, nLastSuperblock, nNextSuperblock);
57
- auto SBEpochTime = static_cast <int64_t >(GetTime<std::chrono::seconds>().count () + (nNextSuperblock - nHeight) * 2.62 * 60 );
59
+ auto SBEpochTime = static_cast <int64_t >(GetTime<std::chrono::seconds>().count () +
60
+ (nNextSuperblock - nHeight) * 2.62 * 60 );
58
61
auto governanceBudget = CSuperblock::GetPaymentsLimit (m_chainman.ActiveChain (), nNextSuperblock);
59
62
60
63
CAmount budgetAllocated{};
@@ -68,9 +71,8 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
68
71
CAmount nAmount{};
69
72
try {
70
73
nAmount = ParsePaymentAmount (jproposal[" payment_amount" ].getValStr ());
71
- }
72
- catch (const std::runtime_error& e) {
73
- LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d Skipping payment exception:%s\n " , __func__,nHeight, e.what ());
74
+ } catch (const std::runtime_error& e) {
75
+ LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d Skipping payment exception:%s\n " , __func__, nHeight, e.what ());
74
76
continue ;
75
77
}
76
78
@@ -86,11 +88,12 @@ std::optional<const CSuperblock> GovernanceSigner::CreateSuperblockCandidate(int
86
88
87
89
// Skip proposals if the SB isn't within the proposal time window
88
90
if (SBEpochTime < windowStart) {
89
- LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d SB:%d windowStart:%d\n " , __func__,nHeight, SBEpochTime, windowStart);
91
+ LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d SB:%d windowStart:%d\n " , __func__, nHeight, SBEpochTime,
92
+ windowStart);
90
93
continue ;
91
94
}
92
95
if (SBEpochTime > windowEnd) {
93
- LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d SB:%d windowEnd:%d\n " , __func__,nHeight, SBEpochTime, windowEnd);
96
+ LogPrint (BCLog::GOBJECT, " %s -- nHeight:%d SB:%d windowEnd:%d\n " , __func__, nHeight, SBEpochTime, windowEnd);
94
97
continue ;
95
98
}
96
99
@@ -121,7 +124,7 @@ std::optional<const CGovernanceObject> GovernanceSigner::CreateGovernanceTrigger
121
124
// no sb_opt, no trigger
122
125
if (!sb_opt.has_value ()) return std::nullopt ;
123
126
124
- // TODO: Check if nHashParentIn, nRevision and nCollateralHashIn are correct
127
+ // TODO: Check if nHashParentIn, nRevision and nCollateralHashIn are correct
125
128
LOCK (::cs_main);
126
129
127
130
// Check if identical trigger (equal DataHash()) is already created (signed by other masternode)
@@ -132,7 +135,7 @@ std::optional<const CGovernanceObject> GovernanceSigner::CreateGovernanceTrigger
132
135
}
133
136
134
137
// Nobody submitted a trigger we'd like to see, so let's do it but only if we are the payee
135
- const CBlockIndex * tip = WITH_LOCK (::cs_main, return m_chainman.ActiveChain ().Tip ());
138
+ const CBlockIndex* tip = WITH_LOCK (::cs_main, return m_chainman.ActiveChain ().Tip ());
136
139
const auto mnList = m_dmnman.GetListForBlock (tip);
137
140
const auto mn_payees = mnList.GetProjectedMNPayees (tip);
138
141
@@ -154,7 +157,8 @@ std::optional<const CGovernanceObject> GovernanceSigner::CreateGovernanceTrigger
154
157
}
155
158
156
159
if (!m_govman.MasternodeRateCheck (gov_sb)) {
157
- LogPrint (BCLog::GOBJECT, " %s -- Trigger rejected because of rate check failure hash(%s)\n " , __func__, gov_sb.GetHash ().ToString ());
160
+ LogPrint (BCLog::GOBJECT, " %s -- Trigger rejected because of rate check failure hash(%s)\n " , __func__,
161
+ gov_sb.GetHash ().ToString ());
158
162
return std::nullopt ;
159
163
}
160
164
@@ -221,21 +225,23 @@ void GovernanceSigner::VoteGovernanceTriggers(const std::optional<const CGoverna
221
225
const uint256 trigger_hash = govobj->GetHash ();
222
226
if (trigger->GetBlockHeight () <= m_govman.GetCachedBlockHeight ()) {
223
227
// ignore triggers from the past
224
- LogPrint (BCLog::GOBJECT, " %s -- Not voting NO-FUNDING for outdated trigger:%s\n " , __func__, trigger_hash.ToString ());
228
+ LogPrint (BCLog::GOBJECT, " %s -- Not voting NO-FUNDING for outdated trigger:%s\n " , __func__,
229
+ trigger_hash.ToString ());
225
230
continue ;
226
231
}
227
232
if (trigger_hash == votedFundingYesTriggerHash) {
228
233
// Skip actual trigger
229
- LogPrint (BCLog::GOBJECT, " %s -- Not voting NO-FUNDING for trigger:%s, we voted yes for it already\n " , __func__, trigger_hash.ToString ());
234
+ LogPrint (BCLog::GOBJECT, " %s -- Not voting NO-FUNDING for trigger:%s, we voted yes for it already\n " ,
235
+ __func__, trigger_hash.ToString ());
230
236
continue ;
231
237
}
232
238
if (vote_rec_t voteRecord; govobj->GetCurrentMNVotes (m_mn_activeman.GetOutPoint (), voteRecord)) {
233
239
const auto & strFunc = __func__;
234
240
if (ranges::any_of (voteRecord.mapInstances , [&](const auto & voteInstancePair) {
235
241
if (voteInstancePair.first == VOTE_SIGNAL_FUNDING) {
236
242
LogPrint (BCLog::GOBJECT, /* Continued */
237
- " %s -- Not voting NO-FUNDING for trigger:%s, we voted %s for it already\n " ,
238
- strFunc, trigger_hash.ToString (),
243
+ " %s -- Not voting NO-FUNDING for trigger:%s, we voted %s for it already\n " , strFunc,
244
+ trigger_hash.ToString (),
239
245
CGovernanceVoting::ConvertOutcomeToString (voteInstancePair.second .eOutcome ));
240
246
return true ;
241
247
}
@@ -261,7 +267,8 @@ bool GovernanceSigner::VoteFundingTrigger(const uint256& nHash, const vote_outco
261
267
262
268
CGovernanceException exception;
263
269
if (!m_govman.ProcessVoteAndRelay (vote, exception, m_connman)) {
264
- LogPrint (BCLog::GOBJECT, " %s -- Vote FUNDING %d for trigger:%s failed:%s\n " , __func__, outcome, nHash.ToString (), exception.what ());
270
+ LogPrint (BCLog::GOBJECT, " %s -- Vote FUNDING %d for trigger:%s failed:%s\n " , __func__, outcome,
271
+ nHash.ToString (), exception.what ());
265
272
return false ;
266
273
}
267
274
0 commit comments