Add SPORK_19_CHAINLOCKS_ENABLED
This commit is contained in:
parent
29532ba196
commit
135829dc49
@ -10,6 +10,7 @@
|
|||||||
#include "chain.h"
|
#include "chain.h"
|
||||||
#include "net_processing.h"
|
#include "net_processing.h"
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
|
#include "spork.h"
|
||||||
#include "validation.h"
|
#include "validation.h"
|
||||||
|
|
||||||
namespace llmq
|
namespace llmq
|
||||||
@ -56,6 +57,10 @@ bool CChainLocksHandler::GetChainLockByHash(const uint256& hash, llmq::CChainLoc
|
|||||||
|
|
||||||
void CChainLocksHandler::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
|
void CChainLocksHandler::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
|
||||||
{
|
{
|
||||||
|
if (!sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (strCommand == NetMsgType::CLSIG) {
|
if (strCommand == NetMsgType::CLSIG) {
|
||||||
CChainLockSig clsig;
|
CChainLockSig clsig;
|
||||||
vRecv >> clsig;
|
vRecv >> clsig;
|
||||||
@ -171,6 +176,9 @@ void CChainLocksHandler::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBl
|
|||||||
if (!pindexNew->pprev) {
|
if (!pindexNew->pprev) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// DIP8 defines a process called "Signing attempts" which should run before the CLSIG is finalized
|
// DIP8 defines a process called "Signing attempts" which should run before the CLSIG is finalized
|
||||||
// To simplify the initial implementation, we skip this process and directly try to create a CLSIG
|
// To simplify the initial implementation, we skip this process and directly try to create a CLSIG
|
||||||
@ -257,6 +265,10 @@ void CChainLocksHandler::EnforceBestChainLock()
|
|||||||
|
|
||||||
void CChainLocksHandler::HandleNewRecoveredSig(const llmq::CRecoveredSig& recoveredSig)
|
void CChainLocksHandler::HandleNewRecoveredSig(const llmq::CRecoveredSig& recoveredSig)
|
||||||
{
|
{
|
||||||
|
if (!sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CChainLockSig clsig;
|
CChainLockSig clsig;
|
||||||
{
|
{
|
||||||
LOCK(cs);
|
LOCK(cs);
|
||||||
@ -316,6 +328,10 @@ void CChainLocksHandler::DoInvalidateBlock(const CBlockIndex* pindex, bool activ
|
|||||||
|
|
||||||
bool CChainLocksHandler::HasChainLock(int nHeight, const uint256& blockHash)
|
bool CChainLocksHandler::HasChainLock(int nHeight, const uint256& blockHash)
|
||||||
{
|
{
|
||||||
|
if (!sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LOCK(cs);
|
LOCK(cs);
|
||||||
return InternalHasChainLock(nHeight, blockHash);
|
return InternalHasChainLock(nHeight, blockHash);
|
||||||
}
|
}
|
||||||
@ -342,6 +358,10 @@ bool CChainLocksHandler::InternalHasChainLock(int nHeight, const uint256& blockH
|
|||||||
|
|
||||||
bool CChainLocksHandler::HasConflictingChainLock(int nHeight, const uint256& blockHash)
|
bool CChainLocksHandler::HasConflictingChainLock(int nHeight, const uint256& blockHash)
|
||||||
{
|
{
|
||||||
|
if (!sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LOCK(cs);
|
LOCK(cs);
|
||||||
return InternalHasConflictingChainLock(nHeight, blockHash);
|
return InternalHasConflictingChainLock(nHeight, blockHash);
|
||||||
}
|
}
|
||||||
|
@ -287,6 +287,7 @@ int CSporkManager::GetSporkIDByName(const std::string& strName)
|
|||||||
if (strName == "SPORK_16_INSTANTSEND_AUTOLOCKS") return SPORK_16_INSTANTSEND_AUTOLOCKS;
|
if (strName == "SPORK_16_INSTANTSEND_AUTOLOCKS") return SPORK_16_INSTANTSEND_AUTOLOCKS;
|
||||||
if (strName == "SPORK_17_QUORUM_DKG_ENABLED") return SPORK_17_QUORUM_DKG_ENABLED;
|
if (strName == "SPORK_17_QUORUM_DKG_ENABLED") return SPORK_17_QUORUM_DKG_ENABLED;
|
||||||
if (strName == "SPORK_18_QUORUM_DEBUG_ENABLED") return SPORK_18_QUORUM_DEBUG_ENABLED;
|
if (strName == "SPORK_18_QUORUM_DEBUG_ENABLED") return SPORK_18_QUORUM_DEBUG_ENABLED;
|
||||||
|
if (strName == "SPORK_19_CHAINLOCKS_ENABLED") return SPORK_19_CHAINLOCKS_ENABLED;
|
||||||
|
|
||||||
LogPrint("spork", "CSporkManager::GetSporkIDByName -- Unknown Spork name '%s'\n", strName);
|
LogPrint("spork", "CSporkManager::GetSporkIDByName -- Unknown Spork name '%s'\n", strName);
|
||||||
return -1;
|
return -1;
|
||||||
@ -304,6 +305,7 @@ std::string CSporkManager::GetSporkNameByID(int nSporkID)
|
|||||||
case SPORK_16_INSTANTSEND_AUTOLOCKS: return "SPORK_16_INSTANTSEND_AUTOLOCKS";
|
case SPORK_16_INSTANTSEND_AUTOLOCKS: return "SPORK_16_INSTANTSEND_AUTOLOCKS";
|
||||||
case SPORK_17_QUORUM_DKG_ENABLED: return "SPORK_17_QUORUM_DKG_ENABLED";
|
case SPORK_17_QUORUM_DKG_ENABLED: return "SPORK_17_QUORUM_DKG_ENABLED";
|
||||||
case SPORK_18_QUORUM_DEBUG_ENABLED: return "SPORK_18_QUORUM_DEBUG_ENABLED";
|
case SPORK_18_QUORUM_DEBUG_ENABLED: return "SPORK_18_QUORUM_DEBUG_ENABLED";
|
||||||
|
case SPORK_19_CHAINLOCKS_ENABLED: return "SPORK_19_CHAINLOCKS_ENABLED";
|
||||||
default:
|
default:
|
||||||
LogPrint("spork", "CSporkManager::GetSporkNameByID -- Unknown Spork ID %d\n", nSporkID);
|
LogPrint("spork", "CSporkManager::GetSporkNameByID -- Unknown Spork ID %d\n", nSporkID);
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
|
@ -26,9 +26,10 @@ static const int SPORK_12_RECONSIDER_BLOCKS = 10011;
|
|||||||
static const int SPORK_16_INSTANTSEND_AUTOLOCKS = 10015;
|
static const int SPORK_16_INSTANTSEND_AUTOLOCKS = 10015;
|
||||||
static const int SPORK_17_QUORUM_DKG_ENABLED = 10016;
|
static const int SPORK_17_QUORUM_DKG_ENABLED = 10016;
|
||||||
static const int SPORK_18_QUORUM_DEBUG_ENABLED = 10017;
|
static const int SPORK_18_QUORUM_DEBUG_ENABLED = 10017;
|
||||||
|
static const int SPORK_19_CHAINLOCKS_ENABLED = 10018;
|
||||||
|
|
||||||
static const int SPORK_START = SPORK_2_INSTANTSEND_ENABLED;
|
static const int SPORK_START = SPORK_2_INSTANTSEND_ENABLED;
|
||||||
static const int SPORK_END = SPORK_18_QUORUM_DEBUG_ENABLED;
|
static const int SPORK_END = SPORK_19_CHAINLOCKS_ENABLED;
|
||||||
|
|
||||||
extern std::map<int, int64_t> mapSporkDefaults;
|
extern std::map<int, int64_t> mapSporkDefaults;
|
||||||
extern CSporkManager sporkManager;
|
extern CSporkManager sporkManager;
|
||||||
|
Loading…
Reference in New Issue
Block a user