Skip to content

Commit

Permalink
Implement LLMQ DKG
Browse files Browse the repository at this point in the history
  • Loading branch information
codablock committed Jan 9, 2019
1 parent 318b598 commit 6836f8c
Show file tree
Hide file tree
Showing 18 changed files with 2,812 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,13 @@ BITCOIN_CORE_H = \
keystore.h \
dbwrapper.h \
limitedmap.h \
llmq/quorums_commitment.h \
llmq/quorums_blockprocessor.h \
llmq/quorums_utils.h \
llmq/quorums_commitment.h \
llmq/quorums_dkgsessionhandler.h \
llmq/quorums_dkgsessionmgr.h \
llmq/quorums_dkgsession.h \
llmq/quorums_init.h \
llmq/quorums_utils.h \
masternode-meta.h \
masternode-payments.h \
masternode-sync.h \
Expand Down Expand Up @@ -249,10 +252,13 @@ libdash_server_a_SOURCES = \
governance-validators.cpp \
governance-vote.cpp \
governance-votedb.cpp \
llmq/quorums_commitment.cpp \
llmq/quorums_blockprocessor.cpp \
llmq/quorums_utils.cpp \
llmq/quorums_commitment.cpp \
llmq/quorums_dkgsessionhandler.cpp \
llmq/quorums_dkgsessionmgr.cpp \
llmq/quorums_dkgsession.cpp \
llmq/quorums_init.cpp \
llmq/quorums_utils.cpp \
masternode-meta.cpp \
masternode-payments.cpp \
masternode-sync.cpp \
Expand Down
24 changes: 24 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ static Consensus::LLMQParams llmq10_60 = {
.dkgPhaseBlocks = 2,
.dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization
.dkgMiningWindowEnd = 18,
.dkgRndSleepTime = 0,
.dkgBadVotesThreshold = 8,

.neighborConnections = 2,
.diagonalConnections = 2,
.keepOldConnections = 24,
};

static Consensus::LLMQParams llmq50_60 = {
Expand All @@ -131,6 +137,12 @@ static Consensus::LLMQParams llmq50_60 = {
.dkgPhaseBlocks = 2,
.dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization
.dkgMiningWindowEnd = 18,
.dkgRndSleepTime = 1 * 60 * 1000,
.dkgBadVotesThreshold = 40,

.neighborConnections = 2,
.diagonalConnections = 2,
.keepOldConnections = 24,
};

static Consensus::LLMQParams llmq400_60 = {
Expand All @@ -144,6 +156,12 @@ static Consensus::LLMQParams llmq400_60 = {
.dkgPhaseBlocks = 4,
.dkgMiningWindowStart = 20, // dkgPhaseBlocks * 5 = after finalization
.dkgMiningWindowEnd = 28,
.dkgRndSleepTime = 2 * 60 * 1000,
.dkgBadVotesThreshold = 300,

.neighborConnections = 4,
.diagonalConnections = 4,
.keepOldConnections = 4,
};

// Used for deployment and min-proto-version signalling, so it needs a higher threshold
Expand All @@ -158,6 +176,12 @@ static Consensus::LLMQParams llmq400_85 = {
.dkgPhaseBlocks = 4,
.dkgMiningWindowStart = 20, // dkgPhaseBlocks * 5 = after finalization
.dkgMiningWindowEnd = 48, // give it a larger mining window to make sure it is mined
.dkgRndSleepTime = 2 * 60 * 1000,
.dkgBadVotesThreshold = 300,

.neighborConnections = 4,
.diagonalConnections = 4,
.keepOldConnections = 4,
};


Expand Down
6 changes: 6 additions & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ struct LLMQParams {
// should at the same time not be too large so that not too much space is wasted with null commitments in case a DKG
// session failed.
int dkgMiningWindowEnd;
int dkgRndSleepTime;
int dkgBadVotesThreshold;

int neighborConnections;
int diagonalConnections;
int keepOldConnections;
};

/**
Expand Down
2 changes: 2 additions & 0 deletions src/dsnotificationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "masternode-payments.h"
#include "masternode-sync.h"
#include "privatesend.h"
#include "llmq/quorums_dkgsessionmgr.h"
#ifdef ENABLE_WALLET
#include "privatesend-client.h"
#endif // ENABLE_WALLET
Expand Down Expand Up @@ -59,6 +60,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
#endif // ENABLE_WALLET
instantsend.UpdatedBlockTip(pindexNew);
governance.UpdatedBlockTip(pindexNew, connman);
llmq::quorumDKGSessionManager->UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload);
}

void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock)
Expand Down
2 changes: 2 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
#include "warnings.h"

#include "evo/deterministicmns.h"
#include "llmq/quorums_init.h"

#include "llmq/quorums_init.h"

Expand Down Expand Up @@ -543,6 +544,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT));
strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
strUsage += HelpMessageOpt("-bip9params=deployment:start:end", "Use given start/end times for specified BIP9 deployment (regtest-only)");
strUsage += HelpMessageOpt("-watchquorums=<n>", strprintf("Watch and validate quorum communication (default: %u)", llmq::DEFAULT_WATCH_QUORUMS));
}
std::string debugCategories = "addrman, alert, bench, cmpctblock, coindb, db, http, leveldb, libevent, lock, mempool, mempoolrej, net, proxy, prune, rand, reindex, rpc, selectcoins, tor, zmq, "
"dash (or specifically: gobject, instantsend, keepass, masternode, mnpayments, mnsync, privatesend, spork)"; // Don't translate these and qt below
Expand Down
Loading

0 comments on commit 6836f8c

Please sign in to comment.