@@ -76,7 +76,7 @@ static RPCHelpMan quorum_list()
76
76
CBlockIndex* pindexTip = WITH_LOCK (cs_main, return chainman.ActiveChain ().Tip ());
77
77
78
78
for (const auto & type : llmq::GetEnabledQuorumTypes (pindexTip)) {
79
- const auto & llmq_params_opt = Params ().GetLLMQ (type);
79
+ const auto llmq_params_opt = Params ().GetLLMQ (type);
80
80
CHECK_NONFATAL (llmq_params_opt.has_value ());
81
81
UniValue v (UniValue::VARR);
82
82
@@ -142,7 +142,7 @@ static RPCHelpMan quorum_list_extended()
142
142
CBlockIndex* pblockindex = nHeight != -1 ? WITH_LOCK (cs_main, return chainman.ActiveChain ()[nHeight]) : WITH_LOCK (cs_main, return chainman.ActiveChain ().Tip ());
143
143
144
144
for (const auto & type : llmq::GetEnabledQuorumTypes (pblockindex)) {
145
- const auto & llmq_params_opt = Params ().GetLLMQ (type);
145
+ const auto llmq_params_opt = Params ().GetLLMQ (type);
146
146
CHECK_NONFATAL (llmq_params_opt.has_value ());
147
147
const auto & llmq_params = llmq_params_opt.value ();
148
148
UniValue v (UniValue::VARR);
@@ -241,12 +241,12 @@ static RPCHelpMan quorum_info()
241
241
const NodeContext& node = EnsureAnyNodeContext (request.context );
242
242
const LLMQContext& llmq_ctx = EnsureLLMQContext (node);
243
243
244
- Consensus::LLMQType llmqType = ( Consensus::LLMQType) ParseInt32V (request.params [0 ], " llmqType" );
244
+ const Consensus::LLMQType llmqType{ static_cast < Consensus::LLMQType>( ParseInt32V (request.params [0 ], " llmqType" ))} ;
245
245
if (!Params ().GetLLMQ (llmqType).has_value ()) {
246
246
throw JSONRPCError (RPC_INVALID_PARAMETER, " invalid LLMQ type" );
247
247
}
248
248
249
- uint256 quorumHash (ParseHashV (request.params [1 ], " quorumHash" ));
249
+ const uint256 quorumHash (ParseHashV (request.params [1 ], " quorumHash" ));
250
250
bool includeSkShare = false ;
251
251
if (!request.params [2 ].isNull ()) {
252
252
includeSkShare = ParseBoolV (request.params [2 ], " includeSkShare" );
@@ -300,7 +300,7 @@ static RPCHelpMan quorum_dkgstatus()
300
300
UniValue minableCommitments (UniValue::VARR);
301
301
UniValue quorumArrConnections (UniValue::VARR);
302
302
for (const auto & type : llmq::GetEnabledQuorumTypes (pindexTip)) {
303
- const auto & llmq_params_opt = Params ().GetLLMQ (type);
303
+ const auto llmq_params_opt = Params ().GetLLMQ (type);
304
304
CHECK_NONFATAL (llmq_params_opt.has_value ());
305
305
const auto & llmq_params = llmq_params_opt.value ();
306
306
bool rotation_enabled = llmq::IsQuorumRotationEnabled (llmq_params, pindexTip);
@@ -400,7 +400,7 @@ static RPCHelpMan quorum_memberof()
400
400
401
401
UniValue result (UniValue::VARR);
402
402
for (const auto & type : llmq::GetEnabledQuorumTypes (pindexTip)) {
403
- const auto & llmq_params_opt = Params ().GetLLMQ (type);
403
+ const auto llmq_params_opt = Params ().GetLLMQ (type);
404
404
CHECK_NONFATAL (llmq_params_opt.has_value ());
405
405
size_t count = llmq_params_opt->signingActiveQuorumCount ;
406
406
if (scanQuorumsCount != -1 ) {
@@ -441,15 +441,14 @@ static RPCHelpMan quorum_sign()
441
441
const NodeContext& node = EnsureAnyNodeContext (request.context );
442
442
const LLMQContext& llmq_ctx = EnsureLLMQContext (node);
443
443
444
- Consensus::LLMQType llmqType = (Consensus::LLMQType)ParseInt32V (request.params [0 ], " llmqType" );
445
-
446
- const auto & llmq_params_opt = Params ().GetLLMQ (llmqType);
444
+ const Consensus::LLMQType llmqType{static_cast <Consensus::LLMQType>(ParseInt32V (request.params [0 ], " llmqType" ))};
445
+ const auto llmq_params_opt = Params ().GetLLMQ (llmqType);
447
446
if (!llmq_params_opt.has_value ()) {
448
447
throw JSONRPCError (RPC_INVALID_PARAMETER, " invalid LLMQ type" );
449
448
}
450
449
451
- uint256 id (ParseHashV (request.params [1 ], " id" ));
452
- uint256 msgHash (ParseHashV (request.params [2 ], " msgHash" ));
450
+ const uint256 id (ParseHashV (request.params [1 ], " id" ));
451
+ const uint256 msgHash (ParseHashV (request.params [2 ], " msgHash" ));
453
452
454
453
uint256 quorumHash;
455
454
if (!request.params [3 ].isNull () && !request.params [3 ].get_str ().empty ()) {
@@ -518,15 +517,15 @@ static RPCHelpMan quorum_verify()
518
517
const NodeContext& node = EnsureAnyNodeContext (request.context );
519
518
const LLMQContext& llmq_ctx = EnsureLLMQContext (node);
520
519
521
- Consensus::LLMQType llmqType = ( Consensus::LLMQType) ParseInt32V (request.params [0 ], " llmqType" );
520
+ const Consensus::LLMQType llmqType{ static_cast < Consensus::LLMQType>( ParseInt32V (request.params [0 ], " llmqType" ))} ;
522
521
523
- const auto & llmq_params_opt = Params ().GetLLMQ (llmqType);
522
+ const auto llmq_params_opt = Params ().GetLLMQ (llmqType);
524
523
if (!llmq_params_opt.has_value ()) {
525
524
throw JSONRPCError (RPC_INVALID_PARAMETER, " invalid LLMQ type" );
526
525
}
527
526
528
- uint256 id (ParseHashV (request.params [1 ], " id" ));
529
- uint256 msgHash (ParseHashV (request.params [2 ], " msgHash" ));
527
+ const uint256 id (ParseHashV (request.params [1 ], " id" ));
528
+ const uint256 msgHash (ParseHashV (request.params [2 ], " msgHash" ));
530
529
531
530
const bool use_bls_legacy = bls::bls_legacy_scheme.load ();
532
531
CBLSSignature sig;
@@ -574,15 +573,13 @@ static RPCHelpMan quorum_hasrecsig()
574
573
const NodeContext& node = EnsureAnyNodeContext (request.context );
575
574
const LLMQContext& llmq_ctx = EnsureLLMQContext (node);
576
575
577
- Consensus::LLMQType llmqType = (Consensus::LLMQType)ParseInt32V (request.params [0 ], " llmqType" );
578
-
579
- const auto & llmq_params_opt = Params ().GetLLMQ (llmqType);
580
- if (!llmq_params_opt.has_value ()) {
576
+ const Consensus::LLMQType llmqType{static_cast <Consensus::LLMQType>(ParseInt32V (request.params [0 ], " llmqType" ))};
577
+ if (!Params ().GetLLMQ (llmqType).has_value ()) {
581
578
throw JSONRPCError (RPC_INVALID_PARAMETER, " invalid LLMQ type" );
582
579
}
583
580
584
- uint256 id (ParseHashV (request.params [1 ], " id" ));
585
- uint256 msgHash (ParseHashV (request.params [2 ], " msgHash" ));
581
+ const uint256 id (ParseHashV (request.params [1 ], " id" ));
582
+ const uint256 msgHash (ParseHashV (request.params [2 ], " msgHash" ));
586
583
587
584
return llmq_ctx.sigman ->HasRecoveredSig (llmqType, id, msgHash);
588
585
},
@@ -605,15 +602,13 @@ static RPCHelpMan quorum_getrecsig()
605
602
const NodeContext& node = EnsureAnyNodeContext (request.context );
606
603
const LLMQContext& llmq_ctx = EnsureLLMQContext (node);
607
604
608
- Consensus::LLMQType llmqType = (Consensus::LLMQType)ParseInt32V (request.params [0 ], " llmqType" );
609
-
610
- const auto & llmq_params_opt = Params ().GetLLMQ (llmqType);
611
- if (!llmq_params_opt.has_value ()) {
605
+ const Consensus::LLMQType llmqType{static_cast <Consensus::LLMQType>(ParseInt32V (request.params [0 ], " llmqType" ))};
606
+ if (!Params ().GetLLMQ (llmqType).has_value ()) {
612
607
throw JSONRPCError (RPC_INVALID_PARAMETER, " invalid LLMQ type" );
613
608
}
614
609
615
- uint256 id (ParseHashV (request.params [1 ], " id" ));
616
- uint256 msgHash (ParseHashV (request.params [2 ], " msgHash" ));
610
+ const uint256 id (ParseHashV (request.params [1 ], " id" ));
611
+ const uint256 msgHash (ParseHashV (request.params [2 ], " msgHash" ));
617
612
618
613
llmq::CRecoveredSig recSig;
619
614
if (!llmq_ctx.sigman ->GetRecoveredSigForId (llmqType, id, recSig)) {
@@ -643,15 +638,13 @@ static RPCHelpMan quorum_isconflicting()
643
638
const NodeContext& node = EnsureAnyNodeContext (request.context );
644
639
const LLMQContext& llmq_ctx = EnsureLLMQContext (node);
645
640
646
- Consensus::LLMQType llmqType = (Consensus::LLMQType)ParseInt32V (request.params [0 ], " llmqType" );
647
-
648
- const auto & llmq_params_opt = Params ().GetLLMQ (llmqType);
649
- if (!llmq_params_opt.has_value ()) {
641
+ const Consensus::LLMQType llmqType{static_cast <Consensus::LLMQType>(ParseInt32V (request.params [0 ], " llmqType" ))};
642
+ if (!Params ().GetLLMQ (llmqType).has_value ()) {
650
643
throw JSONRPCError (RPC_INVALID_PARAMETER, " invalid LLMQ type" );
651
644
}
652
645
653
- uint256 id (ParseHashV (request.params [1 ], " id" ));
654
- uint256 msgHash (ParseHashV (request.params [2 ], " msgHash" ));
646
+ const uint256 id (ParseHashV (request.params [1 ], " id" ));
647
+ const uint256 msgHash (ParseHashV (request.params [2 ], " msgHash" ));
655
648
656
649
return llmq_ctx.sigman ->IsConflicting (llmqType, id, msgHash);
657
650
},
@@ -673,17 +666,17 @@ static RPCHelpMan quorum_selectquorum()
673
666
const NodeContext& node = EnsureAnyNodeContext (request.context );
674
667
const LLMQContext& llmq_ctx = EnsureLLMQContext (node);
675
668
676
- Consensus::LLMQType llmqType = ( Consensus::LLMQType) ParseInt32V (request.params [0 ], " llmqType" );
677
- const auto & llmq_params_opt = Params ().GetLLMQ (llmqType);
669
+ const Consensus::LLMQType llmqType{ static_cast < Consensus::LLMQType>( ParseInt32V (request.params [0 ], " llmqType" ))} ;
670
+ const auto llmq_params_opt = Params ().GetLLMQ (llmqType);
678
671
if (!llmq_params_opt.has_value ()) {
679
672
throw JSONRPCError (RPC_INVALID_PARAMETER, " invalid LLMQ type" );
680
673
}
681
674
682
- uint256 id (ParseHashV (request.params [1 ], " id" ));
675
+ const uint256 id (ParseHashV (request.params [1 ], " id" ));
683
676
684
677
UniValue ret (UniValue::VOBJ);
685
678
686
- auto quorum = llmq::SelectQuorumForSigning (llmq_params_opt.value (), *llmq_ctx.qman , id);
679
+ const auto quorum = llmq::SelectQuorumForSigning (llmq_params_opt.value (), *llmq_ctx.qman , id);
687
680
if (!quorum) {
688
681
throw JSONRPCError (RPC_MISC_ERROR, " no quorums active" );
689
682
}
@@ -973,8 +966,8 @@ static RPCHelpMan verifyislock()
973
966
RPCExamples{" " },
974
967
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
975
968
{
976
- uint256 id (ParseHashV (request.params [0 ], " id" ));
977
- uint256 txid (ParseHashV (request.params [1 ], " txid" ));
969
+ const uint256 id (ParseHashV (request.params [0 ], " id" ));
970
+ const uint256 txid (ParseHashV (request.params [1 ], " txid" ));
978
971
979
972
const NodeContext& node = EnsureAnyNodeContext (request.context );
980
973
const ChainstateManager& chainman = EnsureChainman (node);
@@ -983,7 +976,7 @@ static RPCHelpMan verifyislock()
983
976
g_txindex->BlockUntilSyncedToCurrentChain ();
984
977
}
985
978
986
- CBlockIndex* pindexMined{nullptr };
979
+ const CBlockIndex* pindexMined{nullptr };
987
980
{
988
981
LOCK (cs_main);
989
982
uint256 hash_block;
@@ -1027,9 +1020,9 @@ static RPCHelpMan verifyislock()
1027
1020
1028
1021
auto llmqType = Params ().GetConsensus ().llmqTypeDIP0024InstantSend ;
1029
1022
// First check against the current active set, if it fails check against the last active set
1030
- const auto & llmq_params_opt = Params ().GetLLMQ (llmqType);
1023
+ const auto llmq_params_opt = Params ().GetLLMQ (llmqType);
1031
1024
CHECK_NONFATAL (llmq_params_opt.has_value ());
1032
- int signOffset{llmq_params_opt->dkgInterval };
1025
+ const int signOffset{llmq_params_opt->dkgInterval };
1033
1026
return llmq::VerifyRecoveredSig (llmqType, *llmq_ctx.qman , signHeight, id, txid, sig, 0 ) ||
1034
1027
llmq::VerifyRecoveredSig (llmqType, *llmq_ctx.qman , signHeight, id, txid, sig, signOffset);
1035
1028
},
0 commit comments