Skip to content
Closed
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
4 changes: 4 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ BITCOIN_CORE_H = \
llmq/snapshot.h \
llmq/signing.h \
llmq/signing_shares.h \
llmq/complex_utils.h \
llmq/utils.h \
llmq/params.h \
logging.h \
Expand Down Expand Up @@ -292,6 +293,7 @@ BITCOIN_CORE_H = \
util/check.h \
util/error.h \
util/fees.h \
util/hexstr.h \
util/irange.h \
util/spanparsing.h \
util/system.h \
Expand Down Expand Up @@ -402,6 +404,7 @@ libdash_server_a_SOURCES = \
llmq/snapshot.cpp \
llmq/signing.cpp \
llmq/signing_shares.cpp \
llmq/complex_utils.cpp \
llmq/utils.cpp \
mapport.cpp \
masternode/node.cpp \
Expand Down Expand Up @@ -700,6 +703,7 @@ libdash_util_a_SOURCES = \
util/error.cpp \
util/fees.cpp \
util/getuniquepath.cpp \
util/hexstr.cpp \
util/system.cpp \
util/asmap.cpp \
util/moneystr.cpp \
Expand Down
1 change: 1 addition & 0 deletions src/bloom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <script/standard.h>
#include <random.h>
#include <streams.h>
#include <logging.h>

#include <math.h>
#include <stdlib.h>
Expand Down
3 changes: 3 additions & 0 deletions src/evo/cbtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
#include <evo/deterministicmns.h>
#include <llmq/blockprocessor.h>
#include <llmq/commitment.h>
#include <llmq/utils.h>
#include <evo/simplifiedmns.h>
#include <evo/specialtx.h>
#include <consensus/validation.h>

#include <chain.h>
#include <chainparams.h>
#include <consensus/merkle.h>
#include <util/time.h>
#include <logging.h>

bool CheckCbTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state)
{
Expand Down
5 changes: 4 additions & 1 deletion src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
#include <evo/dmnstate.h>
#include <evo/specialtx.h>
#include <evo/simplifiedmns.h>
#include <evo/evodb.h>
#include <llmq/commitment.h>
#include <llmq/utils.h>
#include <llmq/complex_utils.h>
#include <llmq/params.h>
#include <evo/providertx.h>

#include <base58.h>
Expand Down Expand Up @@ -876,7 +879,7 @@ void CDeterministicMNManager::HandleQuorumCommitment(const llmq::CFinalCommitmen
{
// The commitment has already been validated at this point, so it's safe to use members of it

auto members = llmq::CLLMQUtils::GetAllQuorumMembers(qc.llmqType, pQuorumBaseBlockIndex);
auto members = llmq::CLLMQComplexUtils::GetAllQuorumMembers(qc.llmqType, pQuorumBaseBlockIndex);

for (size_t i = 0; i < members.size(); i++) {
if (!mnList.HasMN(members[i]->proTxHash)) {
Expand Down
4 changes: 3 additions & 1 deletion src/evo/deterministicmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <arith_uint256.h>
#include <crypto/common.h>
#include <consensus/params.h>
#include <evo/evodb.h>
#include <evo/providertx.h>
#include <saltedhasher.h>
#include <scheduler.h>
Expand All @@ -29,6 +28,9 @@ class CSimplifiedMNListDiff;

extern CCriticalSection cs_main;

class CEvoDB;
class CDBBatch;

namespace llmq
{
class CFinalCommitment;
Expand Down
1 change: 1 addition & 0 deletions src/evo/mnhftx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <evo/specialtx.h>
#include <llmq/commitment.h>
#include <llmq/signing.h>
#include <llmq/utils.h>

#include <chain.h>
#include <chainparams.h>
Expand Down
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#include <walletinitinterface.h>

#include <evo/deterministicmns.h>
#include <evo/evodb.h>
#include <llmq/blockprocessor.h>
#include <llmq/init.h>
#include <llmq/quorums.h>
Expand Down
8 changes: 5 additions & 3 deletions src/llmq/blockprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include <llmq/blockprocessor.h>
#include <llmq/commitment.h>
#include <llmq/utils.h>
#include <llmq/complex_utils.h>

#include <evo/evodb.h>
#include <evo/specialtx.h>
Expand Down Expand Up @@ -37,7 +39,7 @@ static const std::string DB_BEST_BLOCK_UPGRADE = "q_bbu2";
CQuorumBlockProcessor::CQuorumBlockProcessor(CEvoDB &_evoDb, CConnman& _connman) :
evoDb(_evoDb), connman(_connman)
{
CLLMQUtils::InitQuorumsCache(mapHasMinedCommitmentCache);
CLLMQComplexUtils::InitQuorumsCache(mapHasMinedCommitmentCache);
}

void CQuorumBlockProcessor::ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRecv)
Expand Down Expand Up @@ -130,7 +132,7 @@ bool CQuorumBlockProcessor::ProcessBlock(const CBlock& block, const CBlockIndex*
return true;
}

llmq::CLLMQUtils::PreComputeQuorumMembers(pindex);
llmq::CLLMQComplexUtils::PreComputeQuorumMembers(pindex);

std::multimap<Consensus::LLMQType, CFinalCommitment> qcs;
if (!GetCommitmentsFromBlock(block, pindex, qcs, state)) {
Expand All @@ -143,7 +145,7 @@ bool CQuorumBlockProcessor::ProcessBlock(const CBlock& block, const CBlockIndex*
// until the first non-null commitment has been mined. After the non-null commitment, no other commitments are
// allowed, including null commitments.
// Note: must only check quorums that were enabled at the _previous_ block height to match mining logic
for (const Consensus::LLMQParams& params : CLLMQUtils::GetEnabledQuorumParams(pindex->pprev)) {
for (const Consensus::LLMQParams& params : CLLMQComplexUtils::GetEnabledQuorumParams(pindex->pprev)) {
// skip these checks when replaying blocks after the crash
if (::ChainActive().Tip() == nullptr) {
break;
Expand Down
32 changes: 31 additions & 1 deletion src/llmq/commitment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include <llmq/commitment.h>

#include <llmq/utils.h>
#include <llmq/complex_utils.h>
#include <evo/deterministicmns.h>
#include <evo/specialtx.h>

Expand Down Expand Up @@ -79,7 +81,7 @@ bool CFinalCommitment::Verify(const CBlockIndex* pQuorumBaseBlockIndex, bool che
LogPrintfFinalCommitment("q[%s] invalid vvecSig\n");
return false;
}
auto members = CLLMQUtils::GetAllQuorumMembers(llmqType, pQuorumBaseBlockIndex);
auto members = CLLMQComplexUtils::GetAllQuorumMembers(llmqType, pQuorumBaseBlockIndex);
std::stringstream ss;
for (const auto i : irange::range(llmq_params.size)) {
ss << "v[" << i << "]=" << validMembers[i];
Expand Down Expand Up @@ -160,6 +162,23 @@ bool CFinalCommitment::VerifySizes(const Consensus::LLMQParams& params) const
return true;
}

//void CFinalCommitment::ToJson(UniValue& obj) const
//{
// obj.setObject();
// obj.pushKV("version", (int)nVersion);
// obj.pushKV("llmqType", (int)llmqType);
// obj.pushKV("quorumHash", quorumHash.ToString());
// obj.pushKV("quorumIndex", quorumIndex);
// obj.pushKV("signersCount", CountSigners());
// obj.pushKV("signers", CLLMQUtils::ToHexStr(signers));
// obj.pushKV("validMembersCount", CountValidMembers());
// obj.pushKV("validMembers", CLLMQUtils::ToHexStr(validMembers));
// obj.pushKV("quorumPublicKey", quorumPublicKey.ToString());
// obj.pushKV("quorumVvecHash", quorumVvecHash.ToString());
// obj.pushKV("quorumSig", quorumSig.ToString());
// obj.pushKV("membersSig", membersSig.ToString());
//}
//
Comment on lines +165 to +181
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

bool CheckLLMQCommitment(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state)
{
CFinalCommitmentTxPayload qcTx;
Expand Down Expand Up @@ -217,4 +236,15 @@ bool CheckLLMQCommitment(const CTransaction& tx, const CBlockIndex* pindexPrev,
return true;
}

//void CFinalCommitmentTxPayload::ToJson(UniValue& obj) const
//{
// obj.setObject();
// obj.pushKV("version", int(nVersion));
// obj.pushKV("height", int(nHeight));
//
// UniValue qcObj;
// commitment.ToJson(qcObj);
// obj.pushKV("commitment", qcObj);
//}

Comment on lines +239 to +249
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

} // namespace llmq
13 changes: 10 additions & 3 deletions src/llmq/commitment.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
#ifndef BITCOIN_LLMQ_COMMITMENT_H
#define BITCOIN_LLMQ_COMMITMENT_H

#include <llmq/utils.h>
#include <bls/bls.h>
#include <llmq/params.h>
#include <primitives/transaction.h>
#include <util/hexstr.h>

#include <univalue.h>

class CValidationState;

class CBlockIndex;
class CTransaction;

namespace llmq
{

Expand Down Expand Up @@ -105,9 +110,9 @@ class CFinalCommitment
obj.pushKV("quorumHash", quorumHash.ToString());
obj.pushKV("quorumIndex", quorumIndex);
obj.pushKV("signersCount", CountSigners());
obj.pushKV("signers", CLLMQUtils::ToHexStr(signers));
obj.pushKV("signers", BitsToHexStr(signers));
obj.pushKV("validMembersCount", CountValidMembers());
obj.pushKV("validMembers", CLLMQUtils::ToHexStr(validMembers));
obj.pushKV("validMembers", BitsToHexStr(validMembers));
obj.pushKV("quorumPublicKey", quorumPublicKey.ToString());
obj.pushKV("quorumVvecHash", quorumVvecHash.ToString());
obj.pushKV("quorumSig", quorumSig.ToString());
Expand All @@ -127,6 +132,8 @@ class CFinalCommitmentTxPayload
CFinalCommitment commitment;

public:
// void ToJson(UniValue& obj) const;

Comment on lines +135 to +136
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

SERIALIZE_METHODS(CFinalCommitmentTxPayload, obj)
{
READWRITE(obj.nVersion, obj.nHeight, obj.commitment);
Expand Down
Loading