Skip to content

Commit

Permalink
Implement and enforce ChainLocks
Browse files Browse the repository at this point in the history
  • Loading branch information
codablock committed Jan 28, 2019
1 parent 2bf6eb1 commit 29532ba
Show file tree
Hide file tree
Showing 12 changed files with 548 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ BITCOIN_CORE_H = \
llmq/quorums.h \
llmq/quorums_blockprocessor.h \
llmq/quorums_commitment.h \
llmq/quorums_chainlocks.h \
llmq/quorums_debug.h \
llmq/quorums_dkgsessionhandler.h \
llmq/quorums_dkgsessionmgr.h \
Expand Down Expand Up @@ -259,6 +260,7 @@ libdash_server_a_SOURCES = \
llmq/quorums.cpp \
llmq/quorums_blockprocessor.cpp \
llmq/quorums_commitment.cpp \
llmq/quorums_chainlocks.cpp \
llmq/quorums_debug.cpp \
llmq/quorums_dkgsessionhandler.cpp \
llmq/quorums_dkgsessionmgr.cpp \
Expand Down
4 changes: 4 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ class CMainParams : public CChainParams {
vSporkAddresses = {"Xgtyuk76vhuFW2iT7UAiHgNdWXCf3J34wh"};
nMinSporkKeys = 1;
fBIP9CheckMasternodesUpgraded = true;
consensus.llmqChainLocks = Consensus::LLMQ_400_60;

checkpointData = (CCheckpointData) {
boost::assign::map_list_of
Expand Down Expand Up @@ -498,6 +499,7 @@ class CTestNetParams : public CChainParams {
vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"};
nMinSporkKeys = 1;
fBIP9CheckMasternodesUpgraded = true;
consensus.llmqChainLocks = Consensus::LLMQ_400_60;

checkpointData = (CCheckpointData) {
boost::assign::map_list_of
Expand Down Expand Up @@ -644,6 +646,7 @@ class CDevNetParams : public CChainParams {
nMinSporkKeys = 1;
// devnets are started with no blocks and no MN, so we can't check for upgraded MN (as there are none)
fBIP9CheckMasternodesUpgraded = false;
consensus.llmqChainLocks = Consensus::LLMQ_400_60;

checkpointData = (CCheckpointData) {
boost::assign::map_list_of
Expand Down Expand Up @@ -758,6 +761,7 @@ class CRegTestParams : public CChainParams {
nMinSporkKeys = 1;
// regtest usually has no masternodes in most tests, so don't check for upgraged MNs
fBIP9CheckMasternodesUpgraded = false;
consensus.llmqChainLocks = Consensus::LLMQ_10_60;

checkpointData = (CCheckpointData){
boost::assign::map_list_of
Expand Down
1 change: 1 addition & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ struct Params {
int nHighSubsidyFactor{1};

std::map<LLMQType, LLMQParams> llmqs;
LLMQType llmqChainLocks;
};
} // namespace Consensus

Expand Down
9 changes: 7 additions & 2 deletions src/dsnotificationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
#include "masternode-payments.h"
#include "masternode-sync.h"
#include "privatesend.h"
#include "llmq/quorums.h"
#include "llmq/quorums_dkgsessionmgr.h"
#ifdef ENABLE_WALLET
#include "privatesend-client.h"
#endif // ENABLE_WALLET
#include "validation.h"

#include "evo/deterministicmns.h"

#include "llmq/quorums.h"
#include "llmq/quorums_chainlocks.h"
#include "llmq/quorums_dkgsessionmgr.h"

void CDSNotificationInterface::InitializeCurrentBlockTip()
{
LOCK(cs_main);
Expand All @@ -26,6 +28,7 @@ void CDSNotificationInterface::InitializeCurrentBlockTip()

void CDSNotificationInterface::AcceptedBlockHeader(const CBlockIndex *pindexNew)
{
llmq::chainLocksHandler->AcceptedBlockHeader(pindexNew);
masternodeSync.AcceptedBlockHeader(pindexNew);
}

Expand Down Expand Up @@ -55,6 +58,8 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
if (fLiteMode)
return;

llmq::chainLocksHandler->UpdatedBlockTip(pindexNew, pindexFork);

CPrivateSend::UpdatedBlockTip(pindexNew);
#ifdef ENABLE_WALLET
privateSendClient.UpdatedBlockTip(pindexNew);
Expand Down
Loading

0 comments on commit 29532ba

Please sign in to comment.