Skip to content

Commit e574bc6

Browse files
committed
scripted-diff: Refactor llmq type consensus param names
-BEGIN VERIFY SCRIPT- sed -i 's/llmqChainLocks/llmqTypeChainLocks/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/llmqForInstantSend/llmqTypeInstantSend/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h -END VERIFY SCRIPT-
1 parent 1c74b66 commit e574bc6

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

src/chainparams.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void CChainParams::UpdateSubsidyAndDiffParams(int nMinimumDifficultyBlocks, int
114114
}
115115

116116
void CChainParams::UpdateLLMQChainLocks(Consensus::LLMQType llmqType) {
117-
consensus.llmqChainLocks = llmqType;
117+
consensus.llmqTypeChainLocks = llmqType;
118118
}
119119

120120
static CBlock FindDevNetGenesisBlock(const Consensus::Params& params, const CBlock &prevBlock, const CAmount& reward)
@@ -348,8 +348,8 @@ class CMainParams : public CChainParams {
348348
consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
349349
consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
350350
consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
351-
consensus.llmqChainLocks = Consensus::LLMQ_400_60;
352-
consensus.llmqForInstantSend = Consensus::LLMQ_50_60;
351+
consensus.llmqTypeChainLocks = Consensus::LLMQ_400_60;
352+
consensus.llmqTypeInstantSend = Consensus::LLMQ_50_60;
353353

354354
fDefaultConsistencyChecks = false;
355355
fRequireStandard = true;
@@ -524,8 +524,8 @@ class CTestNetParams : public CChainParams {
524524
consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
525525
consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
526526
consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
527-
consensus.llmqChainLocks = Consensus::LLMQ_50_60;
528-
consensus.llmqForInstantSend = Consensus::LLMQ_50_60;
527+
consensus.llmqTypeChainLocks = Consensus::LLMQ_50_60;
528+
consensus.llmqTypeInstantSend = Consensus::LLMQ_50_60;
529529

530530
fDefaultConsistencyChecks = false;
531531
fRequireStandard = false;
@@ -679,8 +679,8 @@ class CDevNetParams : public CChainParams {
679679
consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
680680
consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
681681
consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
682-
consensus.llmqChainLocks = Consensus::LLMQ_50_60;
683-
consensus.llmqForInstantSend = Consensus::LLMQ_50_60;
682+
consensus.llmqTypeChainLocks = Consensus::LLMQ_50_60;
683+
consensus.llmqTypeInstantSend = Consensus::LLMQ_50_60;
684684

685685
fDefaultConsistencyChecks = false;
686686
fRequireStandard = false;
@@ -837,8 +837,8 @@ class CRegTestParams : public CChainParams {
837837
// long living quorum params
838838
consensus.llmqs[Consensus::LLMQ_5_60] = llmq5_60;
839839
consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
840-
consensus.llmqChainLocks = Consensus::LLMQ_5_60;
841-
consensus.llmqForInstantSend = Consensus::LLMQ_5_60;
840+
consensus.llmqTypeChainLocks = Consensus::LLMQ_5_60;
841+
consensus.llmqTypeInstantSend = Consensus::LLMQ_5_60;
842842
}
843843
};
844844

src/consensus/params.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ struct Params {
176176
int nHighSubsidyFactor{1};
177177

178178
std::map<LLMQType, LLMQParams> llmqs;
179-
LLMQType llmqChainLocks;
180-
LLMQType llmqForInstantSend{LLMQ_NONE};
179+
LLMQType llmqTypeChainLocks;
180+
LLMQType llmqTypeInstantSend{LLMQ_NONE};
181181
};
182182
} // namespace Consensus
183183

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,10 +1400,10 @@ bool AppInitParameterInteraction()
14001400
}
14011401

14021402
if (chainparams.NetworkIDString() == CBaseChainParams::DEVNET) {
1403-
std::string llmqChainLocks = gArgs.GetArg("-llmqchainlocks", Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqChainLocks).name);
1403+
std::string llmqTypeChainLocks = gArgs.GetArg("-llmqchainlocks", Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqTypeChainLocks).name);
14041404
Consensus::LLMQType llmqType = Consensus::LLMQ_NONE;
14051405
for (const auto& p : Params().GetConsensus().llmqs) {
1406-
if (p.second.name == llmqChainLocks) {
1406+
if (p.second.name == llmqTypeChainLocks) {
14071407
llmqType = p.first;
14081408
break;
14091409
}

src/llmq/quorums_chainlocks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void CChainLocksHandler::ProcessNewChainLock(NodeId from, const llmq::CChainLock
120120

121121
uint256 requestId = ::SerializeHash(std::make_pair(CLSIG_REQUESTID_PREFIX, clsig.nHeight));
122122
uint256 msgHash = clsig.blockHash;
123-
if (!quorumSigningManager->VerifyRecoveredSig(Params().GetConsensus().llmqChainLocks, clsig.nHeight, requestId, msgHash, clsig.sig)) {
123+
if (!quorumSigningManager->VerifyRecoveredSig(Params().GetConsensus().llmqTypeChainLocks, clsig.nHeight, requestId, msgHash, clsig.sig)) {
124124
LogPrintf("CChainLocksHandler::%s -- invalid CLSIG (%s), peer=%d\n", __func__, clsig.ToString(), from);
125125
if (from != -1) {
126126
LOCK(cs_main);
@@ -353,7 +353,7 @@ void CChainLocksHandler::TrySignChainTip()
353353
lastSignedMsgHash = msgHash;
354354
}
355355

356-
quorumSigningManager->AsyncSignIfMember(Params().GetConsensus().llmqChainLocks, requestId, msgHash);
356+
quorumSigningManager->AsyncSignIfMember(Params().GetConsensus().llmqTypeChainLocks, requestId, msgHash);
357357
}
358358

359359
void CChainLocksHandler::TransactionAddedToMempool(const CTransactionRef& tx)

src/llmq/quorums_instantsend.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ bool CInstantSendManager::ProcessTx(const CTransaction& tx, const Consensus::Par
377377
return true;
378378
}
379379

380-
auto llmqType = params.llmqForInstantSend;
380+
auto llmqType = params.llmqTypeInstantSend;
381381
if (llmqType == Consensus::LLMQ_NONE) {
382382
return true;
383383
}
@@ -534,7 +534,7 @@ void CInstantSendManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSi
534534
return;
535535
}
536536

537-
auto llmqType = Params().GetConsensus().llmqForInstantSend;
537+
auto llmqType = Params().GetConsensus().llmqTypeInstantSend;
538538
if (llmqType == Consensus::LLMQ_NONE) {
539539
return;
540540
}
@@ -560,7 +560,7 @@ void CInstantSendManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSi
560560

561561
void CInstantSendManager::HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid)
562562
{
563-
auto llmqType = Params().GetConsensus().llmqForInstantSend;
563+
auto llmqType = Params().GetConsensus().llmqTypeInstantSend;
564564

565565
CTransactionRef tx;
566566
uint256 hashBlock;
@@ -584,7 +584,7 @@ void CInstantSendManager::HandleNewInputLockRecoveredSig(const CRecoveredSig& re
584584

585585
void CInstantSendManager::TrySignInstantSendLock(const CTransaction& tx)
586586
{
587-
auto llmqType = Params().GetConsensus().llmqForInstantSend;
587+
auto llmqType = Params().GetConsensus().llmqTypeInstantSend;
588588

589589
for (auto& in : tx.vin) {
590590
auto id = ::SerializeHash(std::make_pair(INPUTLOCK_REQUESTID_PREFIX, in.prevout));
@@ -729,7 +729,7 @@ bool CInstantSendManager::ProcessPendingInstantSendLocks()
729729
tipHeight = chainActive.Height();
730730
}
731731

732-
auto llmqType = Params().GetConsensus().llmqForInstantSend;
732+
auto llmqType = Params().GetConsensus().llmqTypeInstantSend;
733733

734734
// Every time a new quorum enters the active set, an older one is removed. This means that between two blocks, the
735735
// active set can be different, leading to different selection of the signing quorum. When we detect such rotation
@@ -765,7 +765,7 @@ bool CInstantSendManager::ProcessPendingInstantSendLocks()
765765

766766
std::unordered_set<uint256> CInstantSendManager::ProcessPendingInstantSendLocks(int signHeight, const std::unordered_map<uint256, std::pair<NodeId, CInstantSendLock>>& pend, bool ban)
767767
{
768-
auto llmqType = Params().GetConsensus().llmqForInstantSend;
768+
auto llmqType = Params().GetConsensus().llmqTypeInstantSend;
769769

770770
CBLSBatchVerifier<NodeId, uint256> batchVerifier(false, true, 8);
771771
std::unordered_map<uint256, std::pair<CQuorumCPtr, CRecoveredSig>> recSigs;
@@ -1144,11 +1144,11 @@ void CInstantSendManager::HandleFullyConfirmedBlock(const CBlockIndex* pindex)
11441144

11451145
// no need to keep recovered sigs for fully confirmed IS locks, as there is no chance for conflicts
11461146
// from now on. All inputs are spent now and can't be spend in any other TX.
1147-
quorumSigningManager->RemoveRecoveredSig(consensusParams.llmqForInstantSend, inputRequestId);
1147+
quorumSigningManager->RemoveRecoveredSig(consensusParams.llmqTypeInstantSend, inputRequestId);
11481148
}
11491149

11501150
// same as in the loop
1151-
quorumSigningManager->RemoveRecoveredSig(consensusParams.llmqForInstantSend, islock->GetRequestId());
1151+
quorumSigningManager->RemoveRecoveredSig(consensusParams.llmqTypeInstantSend, islock->GetRequestId());
11521152
}
11531153

11541154
// Find all previously unlocked TXs that got locked by this fully confirmed (ChainLock) block and remove them

src/llmq/quorums_signing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ CQuorumCPtr CSigningManager::SelectQuorumForSigning(Consensus::LLMQType llmqType
889889

890890
bool CSigningManager::VerifyRecoveredSig(Consensus::LLMQType llmqType, int signedAtHeight, const uint256& id, const uint256& msgHash, const CBLSSignature& sig)
891891
{
892-
auto& llmqParams = Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqChainLocks);
892+
auto& llmqParams = Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqTypeChainLocks);
893893

894894
auto quorum = SelectQuorumForSigning(llmqParams.type, signedAtHeight, id);
895895
if (!quorum) {

0 commit comments

Comments
 (0)