Skip to content

Commit 0dc3016

Browse files
Merge #7081: refactor: streamline LLMQ utils and snapshot logic
7c1dc2d lint: apply most `clang-format` suggestions (Kittywhiskers Van Gogh) 3ba6daa refactor: use `UtilParameters` in more LLMQ code (Kittywhiskers Van Gogh) ff71875 refactor: drop `Params()` use in `llmq/utils.cpp` (Kittywhiskers Van Gogh) 8a3d852 refactor: misc. refactoring in `llmq/utils.cpp` (Kittywhiskers Van Gogh) 6a6a240 refactor: simplify `BuildQuorumRotationInfo()` (3/n) (Kittywhiskers Van Gogh) 3e5e273 refactor: simplify `BuildQuorumRotationInfo()` (2/n) (Kittywhiskers Van Gogh) 515163a refactor: simplify `BuildQuorumRotationInfo()` (1/n) (Kittywhiskers Van Gogh) 8c4f83b refactor: introduce `MasternodeScore` for better docs (Kittywhiskers Van Gogh) 85221d4 refactor: introduce `UtilParameters` struct to slim down arguments (Kittywhiskers Van Gogh) 1eb1330 refactor: introduce `QuorumQuarter` struct to reduce code duplication (Kittywhiskers Van Gogh) 3b6d997 refactor: extract quorum cycle data into struct, move ctors to source (Kittywhiskers Van Gogh) 17f5d88 refactor: make `SnapshotSkipMode` an `enum class` (Kittywhiskers Van Gogh) a3a6a7d refactor: move `llmq::utils::BlsCheck` {c,d}tors and functions to source (Kittywhiskers Van Gogh) afb4428 move-only: move `InitQuorumsCache()` to header, drop specializations (Kittywhiskers Van Gogh) 09d522d move-only: move `llmq/util.cpp` internals to anonymous namespace (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Dependent on #7056 ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 7c1dc2d Tree-SHA512: b78c8c7f1ee74dc84a84b9bde75861e931cfa33ffb1eb38cca61de59e4dd1d2685676db9700be6f27c045eb04b2bcea6102d1bc0ef91242b77d8577eee9514f3
2 parents fdf3ab3 + 7c1dc2d commit 0dc3016

17 files changed

+724
-906
lines changed

src/evo/cbtx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ auto CachedGetQcHashesQcIndexedHashes(const CBlockIndex* pindexPrev, const llmq:
7272
qcHashes_cached.clear();
7373
qcIndexedHashes_cached.clear();
7474
if (qc_hashes_cached.empty()) {
75-
llmq::utils::InitQuorumsCache(qc_hashes_cached);
75+
llmq::utils::InitQuorumsCache(qc_hashes_cached, Params().GetConsensus());
7676
}
7777

7878
for (const auto& [llmqType, vecBlockIndexes] : quorums) {

src/evo/specialtxman.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static bool CheckSpecialTxInner(CDeterministicMNManager& dmnman, llmq::CQuorumSn
130130
}
131131
}
132132
case TRANSACTION_QUORUM_COMMITMENT:
133-
return llmq::CheckLLMQCommitment(dmnman, qsnapman, chainman, tx, pindexPrev, state);
133+
return llmq::CheckLLMQCommitment({dmnman, qsnapman, chainman, pindexPrev}, tx, state);
134134
case TRANSACTION_MNHF_SIGNAL:
135135
return CheckMNHFTx(chainman, qman, tx, pindexPrev, state);
136136
case TRANSACTION_ASSET_LOCK:
@@ -442,8 +442,9 @@ bool CSpecialTxProcessor::RebuildListFromBlock(const CBlock& block, gsl::not_nul
442442

443443
// The commitment has already been validated at this point, so it's safe to use members of it
444444

445-
const auto members = llmq::utils::GetAllQuorumMembers(opt_qc->commitment.llmqType, m_dmnman, m_qsnapman,
446-
m_chainman, pQuorumBaseBlockIndex);
445+
const auto members = llmq::utils::GetAllQuorumMembers(opt_qc->commitment.llmqType,
446+
{m_dmnman, m_qsnapman, m_chainman,
447+
pQuorumBaseBlockIndex});
447448
HandleQuorumCommitment(opt_qc->commitment, members, debugLogs, newList);
448449
}
449450
}

src/llmq/blockprocessor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static void PreComputeQuorumMembers(CDeterministicMNManager& dmnman, llmq::CQuor
3232
{
3333
for (const Consensus::LLMQParams& params : llmq::GetEnabledQuorumParams(chainman, pindex->pprev)) {
3434
if (llmq::IsQuorumRotationEnabled(params, pindex) && (pindex->nHeight % params.dkgInterval == 0)) {
35-
llmq::utils::GetAllQuorumMembers(params.type, dmnman, qsnapman, chainman, pindex, reset_cache);
35+
llmq::utils::GetAllQuorumMembers(params.type, {dmnman, qsnapman, chainman, pindex}, reset_cache);
3636
}
3737
}
3838
}
@@ -52,7 +52,7 @@ CQuorumBlockProcessor::CQuorumBlockProcessor(CChainState& chainstate, CDetermini
5252
m_evoDb{evoDb},
5353
m_qsnapman{qsnapman}
5454
{
55-
utils::InitQuorumsCache(mapHasMinedCommitmentCache);
55+
utils::InitQuorumsCache(mapHasMinedCommitmentCache, m_chainstate.m_chainman.GetConsensus());
5656
LogPrintf("BLS verification uses %d additional threads\n", bls_threads);
5757
m_bls_queue.StartWorkerThreads(bls_threads);
5858
}
@@ -145,7 +145,7 @@ MessageProcessingResult CQuorumBlockProcessor::ProcessMessage(const CNode& peer,
145145
}
146146
}
147147

148-
if (!qc.Verify(m_dmnman, m_qsnapman, m_chainstate.m_chainman, pQuorumBaseBlockIndex, /*checkSigs=*/true)) {
148+
if (!qc.Verify({m_dmnman, m_qsnapman, m_chainstate.m_chainman, pQuorumBaseBlockIndex}, /*checkSigs=*/true)) {
149149
LogPrint(BCLog::LLMQ, "CQuorumBlockProcessor::%s -- commitment for quorum %s:%d is not valid quorumIndex[%d] nversion[%d], peer=%d\n",
150150
__func__, qc.quorumHash.ToString(),
151151
ToUnderlying(qc.llmqType), qc.quorumIndex, qc.nVersion, peer.GetId());
@@ -215,7 +215,7 @@ bool CQuorumBlockProcessor::ProcessBlock(const CBlock& block, gsl::not_null<cons
215215
pindex->nHeight, qc.quorumHash.ToString());
216216
return false;
217217
}
218-
qc.VerifySignatureAsync(m_dmnman, m_qsnapman, m_chainstate.m_chainman, pQuorumBaseBlockIndex, &queue_control);
218+
qc.VerifySignatureAsync({m_dmnman, m_qsnapman, m_chainstate.m_chainman, pQuorumBaseBlockIndex}, &queue_control);
219219
}
220220

221221
if (!queue_control.Wait()) {
@@ -337,7 +337,7 @@ bool CQuorumBlockProcessor::ProcessCommitment(int nHeight, const uint256& blockH
337337
}
338338

339339
// we don't validate signatures here; they already validated on previous step
340-
if (!qc.Verify(m_dmnman, m_qsnapman, m_chainstate.m_chainman, pQuorumBaseBlockIndex, /*checksigs=*/false)) {
340+
if (!qc.Verify({m_dmnman, m_qsnapman, m_chainstate.m_chainman, pQuorumBaseBlockIndex}, /*checksigs=*/false)) {
341341
LogPrint(BCLog::LLMQ, /* Continued */
342342
"%s -- height=%d, type=%d, quorumIndex=%d, quorumHash=%s, signers=%s, validMembers=%d, "
343343
"quorumPublicKey=%s qc verify failed.\n",

src/llmq/commitment.cpp

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ CFinalCommitment::CFinalCommitment(const Consensus::LLMQParams& params, const ui
2828
{
2929
}
3030

31-
bool CFinalCommitment::VerifySignatureAsync(CDeterministicMNManager& dmnman, CQuorumSnapshotManager& qsnapman,
32-
const ChainstateManager& chainman,
33-
gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex,
31+
bool CFinalCommitment::VerifySignatureAsync(const llmq::UtilParameters& util_params,
3432
CCheckQueueControl<utils::BlsCheck>* queue_control) const
3533
{
36-
auto members = utils::GetAllQuorumMembers(llmqType, dmnman, qsnapman, chainman, pQuorumBaseBlockIndex);
34+
auto members = utils::GetAllQuorumMembers(llmqType, util_params);
3735
const auto& llmq_params_opt = Params().GetLLMQ(llmqType);
3836
if (!llmq_params_opt.has_value()) {
3937
LogPrint(BCLog::LLMQ, "CFinalCommitment -- q[%s] invalid llmqType=%d\n", quorumHash.ToString(),
@@ -96,9 +94,7 @@ bool CFinalCommitment::VerifySignatureAsync(CDeterministicMNManager& dmnman, CQu
9694
}
9795

9896

99-
bool CFinalCommitment::Verify(CDeterministicMNManager& dmnman, CQuorumSnapshotManager& qsnapman,
100-
const ChainstateManager& chainman,
101-
gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, bool checkSigs) const
97+
bool CFinalCommitment::Verify(const llmq::UtilParameters& util_params, bool checkSigs) const
10298
{
10399
const auto& llmq_params_opt = Params().GetLLMQ(llmqType);
104100
if (!llmq_params_opt.has_value()) {
@@ -107,19 +103,21 @@ bool CFinalCommitment::Verify(CDeterministicMNManager& dmnman, CQuorumSnapshotMa
107103
}
108104
const auto& llmq_params = llmq_params_opt.value();
109105

110-
const uint16_t expected_nversion{CFinalCommitment::GetVersion(IsQuorumRotationEnabled(llmq_params, pQuorumBaseBlockIndex),
111-
DeploymentActiveAfter(pQuorumBaseBlockIndex, chainman.GetConsensus(), Consensus::DEPLOYMENT_V19))};
106+
const uint16_t expected_nversion{
107+
CFinalCommitment::GetVersion(IsQuorumRotationEnabled(llmq_params, util_params.m_base_index),
108+
DeploymentActiveAfter(util_params.m_base_index, util_params.m_chainman.GetConsensus(),
109+
Consensus::DEPLOYMENT_V19))};
112110
if (nVersion == 0 || nVersion != expected_nversion) {
113111
LogPrint(BCLog::LLMQ, "CFinalCommitment -- q[%s] invalid nVersion=%d expected=%d\n", quorumHash.ToString(), nVersion, expected_nversion);
114112
return false;
115113
}
116114

117-
if (pQuorumBaseBlockIndex->GetBlockHash() != quorumHash) {
115+
if (util_params.m_base_index->GetBlockHash() != quorumHash) {
118116
LogPrint(BCLog::LLMQ, "CFinalCommitment -- q[%s] invalid quorumHash\n", quorumHash.ToString());
119117
return false;
120118
}
121119

122-
if ((pQuorumBaseBlockIndex->nHeight % llmq_params.dkgInterval) != quorumIndex) {
120+
if ((util_params.m_base_index->nHeight % llmq_params.dkgInterval) != quorumIndex) {
123121
LogPrint(BCLog::LLMQ, "CFinalCommitment -- q[%s] invalid quorumIndex=%d\n", quorumHash.ToString(), quorumIndex);
124122
return false;
125123
}
@@ -152,7 +150,7 @@ bool CFinalCommitment::Verify(CDeterministicMNManager& dmnman, CQuorumSnapshotMa
152150
LogPrint(BCLog::LLMQ, "CFinalCommitment -- q[%s] invalid vvecSig\n", quorumHash.ToString());
153151
return false;
154152
}
155-
auto members = utils::GetAllQuorumMembers(llmqType, dmnman, qsnapman, chainman, pQuorumBaseBlockIndex);
153+
auto members = utils::GetAllQuorumMembers(llmqType, util_params);
156154
if (LogAcceptDebug(BCLog::LLMQ)) {
157155
std::stringstream ss;
158156
std::stringstream ss2;
@@ -176,7 +174,7 @@ bool CFinalCommitment::Verify(CDeterministicMNManager& dmnman, CQuorumSnapshotMa
176174

177175
// sigs are only checked when the block is processed
178176
if (checkSigs) {
179-
if (!VerifySignatureAsync(dmnman, qsnapman, chainman, pQuorumBaseBlockIndex, nullptr)) {
177+
if (!VerifySignatureAsync(util_params, /*queue_control=*/nullptr)) {
180178
return false;
181179
}
182180
}
@@ -215,20 +213,20 @@ bool CFinalCommitment::VerifySizes(const Consensus::LLMQParams& params) const
215213
return true;
216214
}
217215

218-
bool CheckLLMQCommitment(CDeterministicMNManager& dmnman, CQuorumSnapshotManager& qsnapman,
219-
const ChainstateManager& chainman, const CTransaction& tx,
220-
gsl::not_null<const CBlockIndex*> pindexPrev, TxValidationState& state)
216+
bool CheckLLMQCommitment(const llmq::UtilParameters& util_params, const CTransaction& tx, TxValidationState& state)
221217
{
222218
const auto opt_qcTx = GetTxPayload<CFinalCommitmentTxPayload>(tx);
223219
if (!opt_qcTx) {
224-
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] GetTxPayload LLMQCommitment failed\n", pindexPrev->nHeight);
220+
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] GetTxPayload LLMQCommitment failed\n",
221+
util_params.m_base_index->nHeight);
225222
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-qc-payload");
226223
}
227224
auto& qcTx = *opt_qcTx;
228225

229226
const auto& llmq_params_opt = Params().GetLLMQ(qcTx.commitment.llmqType);
230227
if (!llmq_params_opt.has_value()) {
231-
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] GetLLMQ failed for llmqType[%d]\n", pindexPrev->nHeight, ToUnderlying(qcTx.commitment.llmqType));
228+
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] GetLLMQ failed for llmqType[%d]\n",
229+
util_params.m_base_index->nHeight, ToUnderlying(qcTx.commitment.llmqType));
232230
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-qc-commitment-type");
233231
}
234232

@@ -242,40 +240,44 @@ bool CheckLLMQCommitment(CDeterministicMNManager& dmnman, CQuorumSnapshotManager
242240
}
243241

244242
if (qcTx.nVersion == 0 || qcTx.nVersion > CFinalCommitmentTxPayload::CURRENT_VERSION) {
245-
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] invalid qcTx.nVersion[%d]\n", pindexPrev->nHeight, qcTx.nVersion);
243+
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] invalid qcTx.nVersion[%d]\n",
244+
util_params.m_base_index->nHeight, qcTx.nVersion);
246245
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-qc-version");
247246
}
248247

249-
if (qcTx.nHeight != uint32_t(pindexPrev->nHeight + 1)) {
250-
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] invalid qcTx.nHeight[%d]\n", pindexPrev->nHeight, qcTx.nHeight);
248+
if (qcTx.nHeight != uint32_t(util_params.m_base_index->nHeight + 1)) {
249+
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] invalid qcTx.nHeight[%d]\n", util_params.m_base_index->nHeight,
250+
qcTx.nHeight);
251251
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-qc-height");
252252
}
253253

254-
const CBlockIndex* pQuorumBaseBlockIndex = WITH_LOCK(::cs_main, return chainman.m_blockman.LookupBlockIndex(qcTx.commitment.quorumHash));
254+
const CBlockIndex* pQuorumBaseBlockIndex =
255+
WITH_LOCK(::cs_main, return util_params.m_chainman.m_blockman.LookupBlockIndex(qcTx.commitment.quorumHash));
255256
if (pQuorumBaseBlockIndex == nullptr) {
256257
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-qc-quorum-hash");
257258
}
258259

259-
260-
if (pQuorumBaseBlockIndex != pindexPrev->GetAncestor(pQuorumBaseBlockIndex->nHeight)) {
260+
if (pQuorumBaseBlockIndex != util_params.m_base_index->GetAncestor(pQuorumBaseBlockIndex->nHeight)) {
261261
// not part of active chain
262262
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-qc-quorum-hash");
263263
}
264264

265265
if (qcTx.commitment.IsNull()) {
266266
if (!qcTx.commitment.VerifyNull()) {
267-
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] invalid qcTx.commitment[%s] VerifyNull failed\n", pindexPrev->nHeight, qcTx.commitment.quorumHash.ToString());
267+
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] invalid qcTx.commitment[%s] VerifyNull failed\n",
268+
util_params.m_base_index->nHeight, qcTx.commitment.quorumHash.ToString());
268269
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-qc-invalid-null");
269270
}
270271
return true;
271272
}
272273

273-
if (!qcTx.commitment.Verify(dmnman, qsnapman, chainman, pQuorumBaseBlockIndex, false)) {
274-
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] invalid qcTx.commitment[%s] Verify failed\n", pindexPrev->nHeight, qcTx.commitment.quorumHash.ToString());
274+
if (!qcTx.commitment.Verify(util_params.replace_index(pQuorumBaseBlockIndex), false)) {
275+
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] invalid qcTx.commitment[%s] Verify failed\n",
276+
util_params.m_base_index->nHeight, qcTx.commitment.quorumHash.ToString());
275277
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-qc-invalid");
276278
}
277279

278-
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] CheckLLMQCommitment VALID\n", pindexPrev->nHeight);
280+
LogPrint(BCLog::LLMQ, "CFinalCommitment -- h[%d] CheckLLMQCommitment VALID\n", util_params.m_base_index->nHeight);
279281

280282
return true;
281283
}

src/llmq/commitment.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ class TxValidationState;
3030
template <typename T>
3131
class CCheckQueueControl;
3232
struct RPCResult;
33-
3433
namespace llmq {
3534
class CQuorumSnapshotManager;
35+
struct UtilParameters;
3636
namespace utils {
3737
struct BlsCheck;
3838
} // namespace utils
39+
} // namespace llmq
3940

41+
namespace llmq {
4042
// This message is an aggregation of all received premature commitments and only valid if
4143
// enough (>=threshold) premature commitments were aggregated
4244
// This is mined on-chain as part of TRANSACTION_QUORUM_COMMITMENT
@@ -74,11 +76,9 @@ class CFinalCommitment
7476
return int(std::count(validMembers.begin(), validMembers.end(), true));
7577
}
7678

77-
bool VerifySignatureAsync(CDeterministicMNManager& dmnman, CQuorumSnapshotManager& qsnapman,
78-
const ChainstateManager& chainman, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex,
79+
bool VerifySignatureAsync(const llmq::UtilParameters& util_params,
7980
CCheckQueueControl<utils::BlsCheck>* queue_control) const;
80-
bool Verify(CDeterministicMNManager& dmnman, CQuorumSnapshotManager& qsnapman, const ChainstateManager& chainman,
81-
gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, bool checkSigs) const;
81+
bool Verify(const llmq::UtilParameters& util_params, bool checkSigs) const;
8282
bool VerifyNull() const;
8383
bool VerifySizes(const Consensus::LLMQParams& params) const;
8484

@@ -164,9 +164,7 @@ class CFinalCommitmentTxPayload
164164
[[nodiscard]] UniValue ToJson() const;
165165
};
166166

167-
bool CheckLLMQCommitment(CDeterministicMNManager& dmnman, CQuorumSnapshotManager& qsnapman,
168-
const ChainstateManager& chainman, const CTransaction& tx,
169-
gsl::not_null<const CBlockIndex*> pindexPrev, TxValidationState& state);
167+
bool CheckLLMQCommitment(const llmq::UtilParameters& util_params, const CTransaction& tx, TxValidationState& state);
170168

171169
uint256 BuildCommitmentHash(Consensus::LLMQType llmqType, const uint256& blockHash, const std::vector<bool>& validMembers, const CBLSPublicKey& pubKey, const uint256& vvecHash);
172170

src/llmq/core_write.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,22 +182,22 @@ UniValue CQuorumRotationInfo::ToJson() const
182182
UniValue obj(UniValue::VOBJ);
183183
obj.pushKV("extraShare", extraShare);
184184

185-
obj.pushKV("quorumSnapshotAtHMinusC", quorumSnapshotAtHMinusC.ToJson());
186-
obj.pushKV("quorumSnapshotAtHMinus2C", quorumSnapshotAtHMinus2C.ToJson());
187-
obj.pushKV("quorumSnapshotAtHMinus3C", quorumSnapshotAtHMinus3C.ToJson());
185+
obj.pushKV("quorumSnapshotAtHMinusC", cycleHMinusC.m_snap.ToJson());
186+
obj.pushKV("quorumSnapshotAtHMinus2C", cycleHMinus2C.m_snap.ToJson());
187+
obj.pushKV("quorumSnapshotAtHMinus3C", cycleHMinus3C.m_snap.ToJson());
188188

189189
if (extraShare) {
190-
obj.pushKV("quorumSnapshotAtHMinus4C", quorumSnapshotAtHMinus4C.ToJson());
190+
obj.pushKV("quorumSnapshotAtHMinus4C", CHECK_NONFATAL(cycleHMinus4C)->m_snap.ToJson());
191191
}
192192

193193
obj.pushKV("mnListDiffTip", mnListDiffTip.ToJson());
194194
obj.pushKV("mnListDiffH", mnListDiffH.ToJson());
195-
obj.pushKV("mnListDiffAtHMinusC", mnListDiffAtHMinusC.ToJson());
196-
obj.pushKV("mnListDiffAtHMinus2C", mnListDiffAtHMinus2C.ToJson());
197-
obj.pushKV("mnListDiffAtHMinus3C", mnListDiffAtHMinus3C.ToJson());
195+
obj.pushKV("mnListDiffAtHMinusC", cycleHMinusC.m_diff.ToJson());
196+
obj.pushKV("mnListDiffAtHMinus2C", cycleHMinus2C.m_diff.ToJson());
197+
obj.pushKV("mnListDiffAtHMinus3C", cycleHMinus3C.m_diff.ToJson());
198198

199199
if (extraShare) {
200-
obj.pushKV("mnListDiffAtHMinus4C", mnListDiffAtHMinus4C.ToJson());
200+
obj.pushKV("mnListDiffAtHMinus4C", CHECK_NONFATAL(cycleHMinus4C)->m_diff.ToJson());
201201
}
202202
UniValue hqclists(UniValue::VARR);
203203
for (const auto& qc : lastCommitmentPerIndex) {
@@ -242,7 +242,7 @@ UniValue CQuorumSnapshot::ToJson() const
242242
activeQ.push_back(h);
243243
}
244244
obj.pushKV("activeQuorumMembers", activeQ);
245-
obj.pushKV("mnSkipListMode", mnSkipListMode);
245+
obj.pushKV("mnSkipListMode", ToUnderlying(mnSkipListMode));
246246
UniValue skipList(UniValue::VARR);
247247
for (const auto& h : mnSkipList) {
248248
// cppcheck-suppress useStlAlgorithm

src/llmq/debug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ UniValue CDKGDebugSessionStatus::ToJson(CDeterministicMNManager& dmnman, CQuorum
2828
if (detailLevel == 2) {
2929
const CBlockIndex* pindex = WITH_LOCK(::cs_main, return chainman.m_blockman.LookupBlockIndex(quorumHash));
3030
if (pindex != nullptr) {
31-
dmnMembers = utils::GetAllQuorumMembers(llmqType, dmnman, qsnapman, chainman, pindex);
31+
dmnMembers = utils::GetAllQuorumMembers(llmqType, {dmnman, qsnapman, chainman, pindex});
3232
}
3333
}
3434

src/llmq/dkgsession.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ CDKGSession::CDKGSession(const CBlockIndex* pQuorumBaseBlockIndex, const Consens
9292

9393
bool CDKGSession::Init(const uint256& _myProTxHash, int _quorumIndex)
9494
{
95-
const auto mns = utils::GetAllQuorumMembers(params.type, m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index);
95+
const auto mns = utils::GetAllQuorumMembers(params.type, {m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index});
9696
quorumIndex = _quorumIndex;
9797
members.resize(mns.size());
9898
memberIds.resize(members.size());
@@ -137,8 +137,8 @@ bool CDKGSession::Init(const uint256& _myProTxHash, int _quorumIndex)
137137

138138
if (!myProTxHash.IsNull()) {
139139
dkgDebugManager.InitLocalSessionStatus(params, quorumIndex, m_quorum_base_block_index->GetBlockHash(), m_quorum_base_block_index->nHeight);
140-
relayMembers = utils::GetQuorumRelayMembers(params, m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index,
141-
myProTxHash, true);
140+
relayMembers = utils::GetQuorumRelayMembers(params, {m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index}, myProTxHash,
141+
/*onlyOutbound=*/true);
142142
if (LogAcceptDebug(BCLog::LLMQ)) {
143143
std::stringstream ss;
144144
for (const auto& r : relayMembers) {
@@ -1280,7 +1280,7 @@ std::vector<CFinalCommitment> CDKGSession::FinalizeCommitments()
12801280
t2.stop();
12811281

12821282
cxxtimer::Timer t3(true);
1283-
if (!fqc.Verify(m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index, true)) {
1283+
if (!fqc.Verify({m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index}, true)) {
12841284
logger.Batch("failed to verify final commitment");
12851285
continue;
12861286
}
@@ -1343,7 +1343,7 @@ CFinalCommitment CDKGSession::FinalizeSingleCommitment()
13431343
fqc.quorumSig = fqc.membersSig;
13441344
}
13451345

1346-
if (!fqc.Verify(m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index, true)) {
1346+
if (!fqc.Verify({m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index}, true)) {
13471347
logger.Batch("failed to verify final commitment");
13481348
assert(false);
13491349
}

0 commit comments

Comments
 (0)