Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void CChainParams::UpdateSubsidyAndDiffParams(int nMinimumDifficultyBlocks, int
}

void CChainParams::UpdateLLMQChainLocks(Consensus::LLMQType llmqType) {
consensus.llmqChainLocks = llmqType;
consensus.llmqTypeChainLocks = llmqType;
}

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

fDefaultConsistencyChecks = false;
fRequireStandard = true;
Expand Down Expand Up @@ -524,8 +524,8 @@ class CTestNetParams : public CChainParams {
consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
consensus.llmqChainLocks = Consensus::LLMQ_50_60;
consensus.llmqForInstantSend = Consensus::LLMQ_50_60;
consensus.llmqTypeChainLocks = Consensus::LLMQ_50_60;
consensus.llmqTypeInstantSend = Consensus::LLMQ_50_60;

fDefaultConsistencyChecks = false;
fRequireStandard = false;
Expand Down Expand Up @@ -679,8 +679,8 @@ class CDevNetParams : public CChainParams {
consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
consensus.llmqChainLocks = Consensus::LLMQ_50_60;
consensus.llmqForInstantSend = Consensus::LLMQ_50_60;
consensus.llmqTypeChainLocks = Consensus::LLMQ_50_60;
consensus.llmqTypeInstantSend = Consensus::LLMQ_50_60;

fDefaultConsistencyChecks = false;
fRequireStandard = false;
Expand Down Expand Up @@ -837,8 +837,8 @@ class CRegTestParams : public CChainParams {
// long living quorum params
consensus.llmqs[Consensus::LLMQ_5_60] = llmq5_60;
consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
consensus.llmqChainLocks = Consensus::LLMQ_5_60;
consensus.llmqForInstantSend = Consensus::LLMQ_5_60;
consensus.llmqTypeChainLocks = Consensus::LLMQ_5_60;
consensus.llmqTypeInstantSend = Consensus::LLMQ_5_60;
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ struct Params {
int nHighSubsidyFactor{1};

std::map<LLMQType, LLMQParams> llmqs;
LLMQType llmqChainLocks;
LLMQType llmqForInstantSend{LLMQ_NONE};
LLMQType llmqTypeChainLocks;
LLMQType llmqTypeInstantSend{LLMQ_NONE};
};
} // namespace Consensus

Expand Down
4 changes: 2 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1400,10 +1400,10 @@ bool AppInitParameterInteraction()
}

if (chainparams.NetworkIDString() == CBaseChainParams::DEVNET) {
std::string llmqChainLocks = gArgs.GetArg("-llmqchainlocks", Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqChainLocks).name);
std::string llmqTypeChainLocks = gArgs.GetArg("-llmqchainlocks", Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqTypeChainLocks).name);
Consensus::LLMQType llmqType = Consensus::LLMQ_NONE;
for (const auto& p : Params().GetConsensus().llmqs) {
if (p.second.name == llmqChainLocks) {
if (p.second.name == llmqTypeChainLocks) {
llmqType = p.first;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/llmq/quorums_chainlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void CChainLocksHandler::ProcessNewChainLock(NodeId from, const llmq::CChainLock

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

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

void CChainLocksHandler::TransactionAddedToMempool(const CTransactionRef& tx)
Expand Down
16 changes: 8 additions & 8 deletions src/llmq/quorums_instantsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ bool CInstantSendManager::ProcessTx(const CTransaction& tx, const Consensus::Par
return true;
}

auto llmqType = params.llmqForInstantSend;
auto llmqType = params.llmqTypeInstantSend;
if (llmqType == Consensus::LLMQ_NONE) {
return true;
}
Expand Down Expand Up @@ -534,7 +534,7 @@ void CInstantSendManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSi
return;
}

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

void CInstantSendManager::HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid)
{
auto llmqType = Params().GetConsensus().llmqForInstantSend;
auto llmqType = Params().GetConsensus().llmqTypeInstantSend;

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

void CInstantSendManager::TrySignInstantSendLock(const CTransaction& tx)
{
auto llmqType = Params().GetConsensus().llmqForInstantSend;
auto llmqType = Params().GetConsensus().llmqTypeInstantSend;

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

auto llmqType = Params().GetConsensus().llmqForInstantSend;
auto llmqType = Params().GetConsensus().llmqTypeInstantSend;

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

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

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

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

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

// Find all previously unlocked TXs that got locked by this fully confirmed (ChainLock) block and remove them
Expand Down
2 changes: 1 addition & 1 deletion src/llmq/quorums_signing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ CQuorumCPtr CSigningManager::SelectQuorumForSigning(Consensus::LLMQType llmqType

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

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