@@ -18,9 +18,9 @@ namespace {
1818constexpr std::string_view DB_QUORUM_SNAPSHOT{" llmq_S" };
1919
2020// ! Constructs a llmq::CycleData and populate it with metadata
21- std::optional<llmq::CycleData> ConstructCycle (llmq::CQuorumSnapshotManager& qsnapman, const Consensus::LLMQType& llmq_type,
22- bool skip_snap, int32_t height, gsl::not_null< const CBlockIndex*> index_tip ,
23- std::string& error)
21+ std::optional<llmq::CycleData> ConstructCycle (llmq::CQuorumSnapshotManager& qsnapman,
22+ const Consensus::LLMQType& llmq_type, bool skip_snap, int32_t height,
23+ gsl::not_null< const CBlockIndex*> index_tip, std::string& error)
2424{
2525 llmq::CycleData ret;
2626 ret.m_cycle_index = index_tip->GetAncestor (height);
@@ -108,14 +108,17 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
108108
109109 const int cycleLength = llmq_params_opt->dkgInterval ;
110110
111- auto cycle_base_opt = ConstructCycle (qsnapman, llmqType, /* skip_snap=*/ true , /* height=*/ blockIndex->nHeight - (blockIndex->nHeight % cycleLength), blockIndex, errorRet);
111+ auto cycle_base_opt = ConstructCycle (qsnapman, llmqType, /* skip_snap=*/ true ,
112+ /* height=*/ blockIndex->nHeight - (blockIndex->nHeight % cycleLength),
113+ blockIndex, errorRet);
112114 if (!cycle_base_opt.has_value ()) {
113115 return false ;
114116 }
115117 if (use_legacy_construction) {
116118 // Build MN list Diff always with highest baseblock
117119 if (!BuildSimplifiedMNListDiff (dmnman, chainman, qblockman, qman,
118- GetLastBaseBlockHash (baseBlockIndexes, cycle_base_opt->m_work_index , use_legacy_construction),
120+ GetLastBaseBlockHash (baseBlockIndexes, cycle_base_opt->m_work_index ,
121+ use_legacy_construction),
119122 cycle_base_opt->m_work_index ->GetBlockHash (), response.mnListDiffH , errorRet)) {
120123 return false ;
121124 }
@@ -125,13 +128,16 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
125128
126129 auto target_cycles{response.GetCycles ()};
127130 for (size_t idx{0 }; idx < target_cycles.size (); idx++) {
128- auto cycle_opt = ConstructCycle (qsnapman, llmqType, /* skip_snap=*/ false , /* height=*/ cycle_base_opt->m_cycle_index ->nHeight - (cycleLength * (idx + 1 )), tipBlockIndex, errorRet);
131+ auto cycle_opt = ConstructCycle (qsnapman, llmqType, /* skip_snap=*/ false ,
132+ /* height=*/ cycle_base_opt->m_cycle_index ->nHeight - (cycleLength * (idx + 1 )),
133+ tipBlockIndex, errorRet);
129134 if (!cycle_opt.has_value ()) {
130135 return false ;
131136 }
132137 if (use_legacy_construction) {
133138 if (!BuildSimplifiedMNListDiff (dmnman, chainman, qblockman, qman,
134- GetLastBaseBlockHash (baseBlockIndexes, cycle_opt->m_work_index , use_legacy_construction),
139+ GetLastBaseBlockHash (baseBlockIndexes, cycle_opt->m_work_index ,
140+ use_legacy_construction),
135141 cycle_opt->m_work_index ->GetBlockHash (), cycle_opt->m_diff , errorRet)) {
136142 return false ;
137143 }
@@ -165,7 +171,8 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
165171 response.quorumSnapshotList .push_back (cycle_opt->m_snap );
166172 CSimplifiedMNListDiff mnhneeded;
167173 if (!BuildSimplifiedMNListDiff (dmnman, chainman, qblockman, qman,
168- GetLastBaseBlockHash (baseBlockIndexes, cycle_opt->m_work_index , use_legacy_construction),
174+ GetLastBaseBlockHash (baseBlockIndexes, cycle_opt->m_work_index ,
175+ use_legacy_construction),
169176 cycle_opt->m_work_index ->GetBlockHash (), mnhneeded, errorRet)) {
170177 return false ;
171178 }
@@ -179,16 +186,17 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
179186 for (size_t idx = target_cycles.size (); idx-- > 0 ;) {
180187 auto * cycle{target_cycles[idx]};
181188 if (!BuildSimplifiedMNListDiff (dmnman, chainman, qblockman, qman,
182- GetLastBaseBlockHash (baseBlockIndexes, cycle->m_work_index , use_legacy_construction),
183- cycle-> m_work_index -> GetBlockHash (), cycle-> m_diff , errorRet))
184- {
189+ GetLastBaseBlockHash (baseBlockIndexes, cycle->m_work_index ,
190+ use_legacy_construction),
191+ cycle-> m_work_index -> GetBlockHash (), cycle-> m_diff , errorRet)) {
185192 return false ;
186193 }
187194 baseBlockIndexes.push_back (cycle->m_work_index );
188195 }
189196
190197 if (!BuildSimplifiedMNListDiff (dmnman, chainman, qblockman, qman,
191- GetLastBaseBlockHash (baseBlockIndexes, cycle_base_opt->m_work_index , use_legacy_construction),
198+ GetLastBaseBlockHash (baseBlockIndexes, cycle_base_opt->m_work_index ,
199+ use_legacy_construction),
192200 cycle_base_opt->m_work_index ->GetBlockHash (), response.mnListDiffH , errorRet)) {
193201 return false ;
194202 }
@@ -282,5 +290,4 @@ void CQuorumSnapshotManager::StoreSnapshotForBlock(const Consensus::LLMQType llm
282290 m_evoDb.GetRawDB ().Write (std::make_pair (DB_QUORUM_SNAPSHOT, snapshotHash), snapshot);
283291 quorumSnapshotCache.insert (snapshotHash, snapshot);
284292}
285-
286293} // namespace llmq
0 commit comments