2022-06-08 01:36:46 +02:00
|
|
|
// Copyright (c) 2018-2022 The Dash Core developers
|
2018-05-24 16:14:55 +02:00
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2021-10-02 19:32:24 +02:00
|
|
|
#ifndef BITCOIN_LLMQ_DKGSESSION_H
|
|
|
|
#define BITCOIN_LLMQ_DKGSESSION_H
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2023-07-01 02:27:39 +02:00
|
|
|
#include <bls/bls.h>
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <bls/bls_ies.h>
|
|
|
|
#include <bls/bls_worker.h>
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2022-04-16 16:46:04 +02:00
|
|
|
#include <llmq/commitment.h>
|
2021-10-02 19:32:24 +02:00
|
|
|
#include <llmq/utils.h>
|
2023-02-20 11:12:12 +01:00
|
|
|
#include <util/underlying.h>
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2021-11-30 06:03:17 +01:00
|
|
|
#include <optional>
|
|
|
|
|
2018-05-24 16:14:55 +02:00
|
|
|
class UniValue;
|
2021-10-25 15:55:34 +02:00
|
|
|
class CInv;
|
2022-04-07 17:32:40 +02:00
|
|
|
class CConnman;
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
namespace llmq
|
|
|
|
{
|
|
|
|
|
|
|
|
class CFinalCommitment;
|
2022-09-22 13:14:48 +02:00
|
|
|
class CDKGDebugManager;
|
2018-05-24 16:14:55 +02:00
|
|
|
class CDKGSession;
|
|
|
|
class CDKGSessionManager;
|
2019-01-11 13:03:25 +01:00
|
|
|
class CDKGPendingMessages;
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
class CDKGContribution
|
|
|
|
{
|
|
|
|
public:
|
2019-05-28 15:34:41 +02:00
|
|
|
Consensus::LLMQType llmqType;
|
2018-05-24 16:14:55 +02:00
|
|
|
uint256 quorumHash;
|
|
|
|
uint256 proTxHash;
|
|
|
|
BLSVerificationVectorPtr vvec;
|
|
|
|
std::shared_ptr<CBLSIESMultiRecipientObjects<CBLSSecretKey>> contributions;
|
|
|
|
CBLSSignature sig;
|
|
|
|
|
|
|
|
public:
|
|
|
|
template<typename Stream>
|
|
|
|
inline void SerializeWithoutSig(Stream& s) const
|
|
|
|
{
|
2023-02-20 11:12:12 +01:00
|
|
|
s << ToUnderlying(llmqType);
|
2018-05-24 16:14:55 +02:00
|
|
|
s << quorumHash;
|
|
|
|
s << proTxHash;
|
|
|
|
s << *vvec;
|
|
|
|
s << *contributions;
|
|
|
|
}
|
|
|
|
template<typename Stream>
|
|
|
|
inline void Serialize(Stream& s) const
|
|
|
|
{
|
|
|
|
SerializeWithoutSig(s);
|
|
|
|
s << sig;
|
|
|
|
}
|
|
|
|
template<typename Stream>
|
|
|
|
inline void Unserialize(Stream& s)
|
|
|
|
{
|
2023-10-03 16:52:33 +02:00
|
|
|
std::vector<CBLSPublicKey> tmp1;
|
2018-05-24 16:14:55 +02:00
|
|
|
CBLSIESMultiRecipientObjects<CBLSSecretKey> tmp2;
|
|
|
|
|
|
|
|
s >> llmqType;
|
|
|
|
s >> quorumHash;
|
|
|
|
s >> proTxHash;
|
|
|
|
s >> tmp1;
|
|
|
|
s >> tmp2;
|
|
|
|
s >> sig;
|
|
|
|
|
2023-10-03 16:52:33 +02:00
|
|
|
vvec = std::make_shared<std::vector<CBLSPublicKey>>(std::move(tmp1));
|
2018-05-24 16:14:55 +02:00
|
|
|
contributions = std::make_shared<CBLSIESMultiRecipientObjects<CBLSSecretKey>>(std::move(tmp2));
|
|
|
|
}
|
|
|
|
|
2022-05-12 23:11:39 +02:00
|
|
|
[[nodiscard]] uint256 GetSignHash() const
|
2018-05-24 16:14:55 +02:00
|
|
|
{
|
|
|
|
CHashWriter hw(SER_GETHASH, 0);
|
|
|
|
SerializeWithoutSig(hw);
|
|
|
|
hw << CBLSSignature();
|
|
|
|
return hw.GetHash();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class CDKGComplaint
|
|
|
|
{
|
|
|
|
public:
|
2021-10-15 12:28:19 +02:00
|
|
|
Consensus::LLMQType llmqType{Consensus::LLMQType::LLMQ_NONE};
|
2018-05-24 16:14:55 +02:00
|
|
|
uint256 quorumHash;
|
|
|
|
uint256 proTxHash;
|
|
|
|
std::vector<bool> badMembers;
|
|
|
|
std::vector<bool> complainForMembers;
|
|
|
|
CBLSSignature sig;
|
|
|
|
|
|
|
|
public:
|
2020-08-09 23:35:02 +02:00
|
|
|
CDKGComplaint() = default;
|
2022-01-04 17:15:56 +01:00
|
|
|
explicit CDKGComplaint(const Consensus::LLMQParams& params) :
|
|
|
|
badMembers((size_t)params.size), complainForMembers((size_t)params.size) {};
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2021-05-27 17:04:17 +02:00
|
|
|
SERIALIZE_METHODS(CDKGComplaint, obj)
|
2018-05-24 16:14:55 +02:00
|
|
|
{
|
2021-05-27 17:04:17 +02:00
|
|
|
READWRITE(
|
|
|
|
obj.llmqType,
|
|
|
|
obj.quorumHash,
|
|
|
|
obj.proTxHash,
|
|
|
|
DYNBITSET(obj.badMembers),
|
|
|
|
DYNBITSET(obj.complainForMembers),
|
|
|
|
obj.sig
|
|
|
|
);
|
2018-05-24 16:14:55 +02:00
|
|
|
}
|
|
|
|
|
2022-05-12 23:11:39 +02:00
|
|
|
[[nodiscard]] uint256 GetSignHash() const
|
2018-05-24 16:14:55 +02:00
|
|
|
{
|
|
|
|
CDKGComplaint tmp(*this);
|
|
|
|
tmp.sig = CBLSSignature();
|
|
|
|
return ::SerializeHash(tmp);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class CDKGJustification
|
|
|
|
{
|
|
|
|
public:
|
2019-05-28 15:34:41 +02:00
|
|
|
Consensus::LLMQType llmqType;
|
2018-05-24 16:14:55 +02:00
|
|
|
uint256 quorumHash;
|
|
|
|
uint256 proTxHash;
|
2023-11-14 11:07:27 +01:00
|
|
|
struct Contribution {
|
|
|
|
uint32_t index;
|
|
|
|
CBLSSecretKey key;
|
|
|
|
SERIALIZE_METHODS(Contribution, obj)
|
|
|
|
{
|
|
|
|
READWRITE(obj.index, obj.key);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
std::vector<Contribution> contributions;
|
2018-05-24 16:14:55 +02:00
|
|
|
CBLSSignature sig;
|
|
|
|
|
|
|
|
public:
|
2021-05-27 17:17:29 +02:00
|
|
|
SERIALIZE_METHODS(CDKGJustification, obj)
|
2018-05-24 16:14:55 +02:00
|
|
|
{
|
2021-05-27 17:17:29 +02:00
|
|
|
READWRITE(obj.llmqType, obj.quorumHash, obj.proTxHash, obj.contributions, obj.sig);
|
2018-05-24 16:14:55 +02:00
|
|
|
}
|
|
|
|
|
2022-05-12 23:11:39 +02:00
|
|
|
[[nodiscard]] uint256 GetSignHash() const
|
2018-05-24 16:14:55 +02:00
|
|
|
{
|
|
|
|
CDKGJustification tmp(*this);
|
|
|
|
tmp.sig = CBLSSignature();
|
|
|
|
return ::SerializeHash(tmp);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// each member commits to a single set of valid members with this message
|
|
|
|
// then each node aggregate all received premature commitments
|
|
|
|
// into a single CFinalCommitment, which is only valid if
|
|
|
|
// enough (>=minSize) premature commitments were aggregated
|
|
|
|
class CDKGPrematureCommitment
|
|
|
|
{
|
|
|
|
public:
|
2021-10-15 12:28:19 +02:00
|
|
|
Consensus::LLMQType llmqType{Consensus::LLMQType::LLMQ_NONE};
|
2018-05-24 16:14:55 +02:00
|
|
|
uint256 quorumHash;
|
|
|
|
uint256 proTxHash;
|
|
|
|
std::vector<bool> validMembers;
|
|
|
|
|
|
|
|
CBLSPublicKey quorumPublicKey;
|
|
|
|
uint256 quorumVvecHash;
|
|
|
|
|
|
|
|
CBLSSignature quorumSig; // threshold sig share of quorumHash+validMembers+pubKeyHash+vvecHash
|
|
|
|
CBLSSignature sig; // single member sig of quorumHash+validMembers+pubKeyHash+vvecHash
|
|
|
|
|
|
|
|
public:
|
2020-08-09 23:35:02 +02:00
|
|
|
CDKGPrematureCommitment() = default;
|
2022-01-04 17:15:56 +01:00
|
|
|
explicit CDKGPrematureCommitment(const Consensus::LLMQParams& params) :
|
|
|
|
validMembers((size_t)params.size) {};
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2022-05-12 23:11:39 +02:00
|
|
|
[[nodiscard]] int CountValidMembers() const
|
2018-05-24 16:14:55 +02:00
|
|
|
{
|
2022-05-12 23:11:39 +02:00
|
|
|
return int(std::count(validMembers.begin(), validMembers.end(), true));
|
2018-05-24 16:14:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2021-05-27 17:04:17 +02:00
|
|
|
SERIALIZE_METHODS(CDKGPrematureCommitment, obj)
|
2018-05-24 16:14:55 +02:00
|
|
|
{
|
2021-05-27 17:04:17 +02:00
|
|
|
READWRITE(
|
|
|
|
obj.llmqType,
|
|
|
|
obj.quorumHash,
|
|
|
|
obj.proTxHash,
|
|
|
|
DYNBITSET(obj.validMembers),
|
|
|
|
obj.quorumPublicKey,
|
|
|
|
obj.quorumVvecHash,
|
|
|
|
obj.quorumSig,
|
|
|
|
obj.sig
|
|
|
|
);
|
2018-05-24 16:14:55 +02:00
|
|
|
}
|
|
|
|
|
2022-05-12 23:11:39 +02:00
|
|
|
[[nodiscard]] uint256 GetSignHash() const
|
2018-05-24 16:14:55 +02:00
|
|
|
{
|
2022-08-02 19:14:25 +02:00
|
|
|
return utils::BuildCommitmentHash(llmqType, quorumHash, validMembers, quorumPublicKey, quorumVvecHash);
|
2018-05-24 16:14:55 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class CDKGMember
|
|
|
|
{
|
|
|
|
public:
|
2021-11-29 06:12:09 +01:00
|
|
|
CDKGMember(const CDeterministicMNCPtr& _dmn, size_t _idx);
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
CDeterministicMNCPtr dmn;
|
|
|
|
size_t idx;
|
|
|
|
CBLSId id;
|
|
|
|
|
|
|
|
std::set<uint256> contributions;
|
|
|
|
std::set<uint256> complaints;
|
|
|
|
std::set<uint256> justifications;
|
|
|
|
std::set<uint256> prematureCommitments;
|
|
|
|
|
|
|
|
std::set<uint256> badMemberVotes;
|
|
|
|
std::set<uint256> complaintsFromOthers;
|
|
|
|
|
|
|
|
bool bad{false};
|
2020-03-17 12:18:31 +01:00
|
|
|
bool badConnection{false};
|
2018-05-24 16:14:55 +02:00
|
|
|
bool weComplain{false};
|
|
|
|
bool someoneComplain{false};
|
|
|
|
};
|
|
|
|
|
2022-09-06 19:32:53 +02:00
|
|
|
class DKGError {
|
|
|
|
public:
|
|
|
|
enum type {
|
|
|
|
COMPLAIN_LIE = 0,
|
|
|
|
COMMIT_OMIT,
|
|
|
|
COMMIT_LIE,
|
|
|
|
CONTRIBUTION_OMIT,
|
|
|
|
CONTRIBUTION_LIE,
|
|
|
|
JUSTIFY_OMIT,
|
|
|
|
JUSTIFY_LIE,
|
|
|
|
_COUNT
|
|
|
|
};
|
|
|
|
static constexpr DKGError::type from_string(std::string_view in) {
|
|
|
|
if (in == "complain-lie") return COMPLAIN_LIE;
|
|
|
|
if (in == "commit-omit") return COMMIT_OMIT;
|
|
|
|
if (in == "commit-lie") return COMMIT_LIE;
|
|
|
|
if (in == "contribution-omit") return CONTRIBUTION_OMIT;
|
|
|
|
if (in == "contribution-lie") return CONTRIBUTION_LIE;
|
|
|
|
if (in == "justify-lie") return JUSTIFY_LIE;
|
|
|
|
if (in == "justify-omit") return JUSTIFY_OMIT;
|
|
|
|
return _COUNT;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-05-24 16:14:55 +02:00
|
|
|
/**
|
|
|
|
* The DKG session is a single instance of the DKG process. It is owned and called by CDKGSessionHandler, which passes
|
|
|
|
* received DKG messages to the session. The session is not persistent and will loose it's state (the whole object is
|
|
|
|
* discarded) when it finishes (after the mining phase) or is aborted.
|
|
|
|
*
|
|
|
|
* When incoming contributions are received and the verification vector is valid, it is passed to CDKGSessionManager
|
|
|
|
* which will store it in the evo DB. Secret key contributions which are meant for the local member are also passed
|
|
|
|
* to CDKGSessionManager to store them in the evo DB. If verification of the SK contribution initially fails, it is
|
|
|
|
* not passed to CDKGSessionManager. If the justification phase later gives a valid SK contribution from the same
|
|
|
|
* member, it is then passed to CDKGSessionManager and after this handled the same way.
|
|
|
|
*
|
|
|
|
* The contributions stored by CDKGSessionManager are then later loaded by the quorum instances and used for signing
|
|
|
|
* sessions, but only if the local node is a member of the quorum.
|
|
|
|
*/
|
|
|
|
class CDKGSession
|
|
|
|
{
|
|
|
|
friend class CDKGSessionHandler;
|
|
|
|
friend class CDKGSessionManager;
|
|
|
|
friend class CDKGLogger;
|
|
|
|
|
|
|
|
private:
|
2023-03-13 17:11:17 +01:00
|
|
|
const Consensus::LLMQParams params;
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
CBLSWorker& blsWorker;
|
|
|
|
CBLSWorkerCache cache;
|
|
|
|
CDKGSessionManager& dkgManager;
|
2022-09-22 13:14:48 +02:00
|
|
|
CDKGDebugManager& dkgDebugManager;
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2021-10-26 18:08:38 +02:00
|
|
|
const CBlockIndex* m_quorum_base_block_index{nullptr};
|
2022-04-16 16:46:04 +02:00
|
|
|
int quorumIndex{0};
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<std::unique_ptr<CDKGMember>> members;
|
|
|
|
std::map<uint256, size_t> membersMap;
|
2020-06-18 10:40:33 +02:00
|
|
|
std::set<uint256> relayMembers;
|
2018-05-24 16:14:55 +02:00
|
|
|
BLSVerificationVectorPtr vvecContribution;
|
2023-10-03 16:52:33 +02:00
|
|
|
std::vector<CBLSSecretKey> m_sk_contributions;
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2023-10-03 16:52:33 +02:00
|
|
|
std::vector<CBLSId> memberIds;
|
2018-05-24 16:14:55 +02:00
|
|
|
std::vector<BLSVerificationVectorPtr> receivedVvecs;
|
|
|
|
// these are not necessarily verified yet. Only trust in what was written to the DB
|
2023-10-03 16:52:33 +02:00
|
|
|
std::vector<CBLSSecretKey> receivedSkContributions;
|
2021-01-22 16:11:06 +01:00
|
|
|
/// Contains the received unverified/encrypted DKG contributions
|
|
|
|
std::vector<std::shared_ptr<CBLSIESMultiRecipientObjects<CBLSSecretKey>>> vecEncryptedContributions;
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
uint256 myProTxHash;
|
|
|
|
CBLSId myId;
|
2022-04-07 17:32:40 +02:00
|
|
|
CConnman& connman;
|
2021-11-29 06:12:09 +01:00
|
|
|
std::optional<size_t> myIdx;
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
// all indexed by msg hash
|
|
|
|
// we expect to only receive a single vvec and contribution per member, but we must also be able to relay
|
|
|
|
// conflicting messages as otherwise an attacker might be able to broadcast conflicting (valid+invalid) messages
|
|
|
|
// and thus split the quorum. Such members are later removed from the quorum.
|
2023-04-25 13:51:26 +02:00
|
|
|
mutable RecursiveMutex invCs;
|
2021-04-27 16:11:45 +02:00
|
|
|
std::map<uint256, CDKGContribution> contributions GUARDED_BY(invCs);
|
|
|
|
std::map<uint256, CDKGComplaint> complaints GUARDED_BY(invCs);
|
|
|
|
std::map<uint256, CDKGJustification> justifications GUARDED_BY(invCs);
|
|
|
|
std::map<uint256, CDKGPrematureCommitment> prematureCommitments GUARDED_BY(invCs);
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2023-04-25 13:51:26 +02:00
|
|
|
mutable RecursiveMutex cs_pending;
|
2021-04-27 16:11:45 +02:00
|
|
|
std::vector<size_t> pendingContributionVerifications GUARDED_BY(cs_pending);
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
// filled by ReceivePrematureCommitment and used by FinalizeCommitments
|
2021-04-27 16:11:45 +02:00
|
|
|
std::set<uint256> validCommitments GUARDED_BY(invCs);
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
public:
|
2022-09-22 13:14:48 +02:00
|
|
|
CDKGSession(const Consensus::LLMQParams& _params, CBLSWorker& _blsWorker, CDKGSessionManager& _dkgManager, CDKGDebugManager& _dkgDebugManager, CConnman& _connman) :
|
|
|
|
params(_params), blsWorker(_blsWorker), cache(_blsWorker), dkgManager(_dkgManager), dkgDebugManager(_dkgDebugManager), connman(_connman) {}
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2023-10-22 16:14:30 +02:00
|
|
|
bool Init(gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, Span<CDeterministicMNCPtr> mns, const uint256& _myProTxHash, int _quorumIndex);
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2022-09-06 19:32:53 +02:00
|
|
|
[[nodiscard]] std::optional<size_t> GetMyMemberIndex() const { return myIdx; }
|
2019-01-10 07:07:58 +01:00
|
|
|
|
2018-05-24 16:14:55 +02:00
|
|
|
/**
|
|
|
|
* The following sets of methods are for the first 4 phases handled in the session. The flow of message calls
|
|
|
|
* is identical for all phases:
|
|
|
|
* 1. Execute local action (e.g. create/send own contributions)
|
|
|
|
* 2. PreVerify incoming messages for this phase. Preverification means that everything from the message is checked
|
|
|
|
* that does not require too much resources for verification. This specifically excludes all CPU intensive BLS
|
|
|
|
* operations.
|
|
|
|
* 3. CDKGSessionHandler will collect pre verified messages in batches and perform batched BLS signature verification
|
|
|
|
* on these.
|
|
|
|
* 4. ReceiveMessage is called for each pre verified message with a valid signature. ReceiveMessage is also
|
|
|
|
* responsible for further verification of validity (e.g. validate vvecs and SK contributions).
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Phase 1: contribution
|
2019-01-11 13:03:25 +01:00
|
|
|
void Contribute(CDKGPendingMessages& pendingMessages);
|
|
|
|
void SendContributions(CDKGPendingMessages& pendingMessages);
|
2021-01-11 04:28:37 +01:00
|
|
|
bool PreVerifyMessage(const CDKGContribution& qc, bool& retBan) const;
|
2021-01-14 20:42:08 +01:00
|
|
|
void ReceiveMessage(const CDKGContribution& qc, bool& retBan);
|
2021-09-08 00:33:02 +02:00
|
|
|
void VerifyPendingContributions() EXCLUSIVE_LOCKS_REQUIRED(cs_pending);
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
// Phase 2: complaint
|
2019-01-11 13:03:25 +01:00
|
|
|
void VerifyAndComplain(CDKGPendingMessages& pendingMessages);
|
2021-06-26 15:10:53 +02:00
|
|
|
void VerifyConnectionAndMinProtoVersions() const;
|
2019-01-11 13:03:25 +01:00
|
|
|
void SendComplaint(CDKGPendingMessages& pendingMessages);
|
2021-01-11 04:28:37 +01:00
|
|
|
bool PreVerifyMessage(const CDKGComplaint& qc, bool& retBan) const;
|
2021-01-14 20:42:08 +01:00
|
|
|
void ReceiveMessage(const CDKGComplaint& qc, bool& retBan);
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
// Phase 3: justification
|
2019-01-11 13:03:25 +01:00
|
|
|
void VerifyAndJustify(CDKGPendingMessages& pendingMessages);
|
|
|
|
void SendJustification(CDKGPendingMessages& pendingMessages, const std::set<uint256>& forMembers);
|
2021-01-11 04:28:37 +01:00
|
|
|
bool PreVerifyMessage(const CDKGJustification& qj, bool& retBan) const;
|
2021-01-14 20:42:08 +01:00
|
|
|
void ReceiveMessage(const CDKGJustification& qj, bool& retBan);
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
// Phase 4: commit
|
2019-01-11 13:03:25 +01:00
|
|
|
void VerifyAndCommit(CDKGPendingMessages& pendingMessages);
|
|
|
|
void SendCommitment(CDKGPendingMessages& pendingMessages);
|
2021-01-11 04:28:37 +01:00
|
|
|
bool PreVerifyMessage(const CDKGPrematureCommitment& qc, bool& retBan) const;
|
2021-01-14 20:42:08 +01:00
|
|
|
void ReceiveMessage(const CDKGPrematureCommitment& qc, bool& retBan);
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
// Phase 5: aggregate/finalize
|
|
|
|
std::vector<CFinalCommitment> FinalizeCommitments();
|
|
|
|
|
2022-09-06 19:32:53 +02:00
|
|
|
[[nodiscard]] bool AreWeMember() const { return !myProTxHash.IsNull(); }
|
2018-05-24 16:14:55 +02:00
|
|
|
void MarkBadMember(size_t idx);
|
|
|
|
|
2019-01-11 10:00:40 +01:00
|
|
|
void RelayInvToParticipants(const CInv& inv) const;
|
2018-05-24 16:14:55 +02:00
|
|
|
|
|
|
|
public:
|
2022-09-06 19:32:53 +02:00
|
|
|
[[nodiscard]] CDKGMember* GetMember(const uint256& proTxHash) const;
|
2020-12-14 20:53:18 +01:00
|
|
|
|
|
|
|
private:
|
2022-09-06 19:32:53 +02:00
|
|
|
[[nodiscard]] bool ShouldSimulateError(DKGError::type type) const;
|
2018-05-24 16:14:55 +02:00
|
|
|
};
|
|
|
|
|
2022-09-06 19:32:53 +02:00
|
|
|
void SetSimulatedDKGErrorRate(DKGError::type type, double rate);
|
|
|
|
double GetSimulatedErrorRate(DKGError::type type);
|
2019-05-08 11:13:27 +02:00
|
|
|
|
2019-07-15 20:55:01 +02:00
|
|
|
} // namespace llmq
|
2018-05-24 16:14:55 +02:00
|
|
|
|
2021-10-02 19:32:24 +02:00
|
|
|
#endif // BITCOIN_LLMQ_DKGSESSION_H
|