Skip to content
Open
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ BITCOIN_CORE_H = \
llmq/commitment.h \
llmq/context.h \
llmq/debug.h \
llmq/dkgtypes.h \
llmq/dkgsession.h \
llmq/dkgsessionhandler.h \
llmq/dkgsessionmgr.h \
Expand Down
7 changes: 3 additions & 4 deletions src/chainlock/chainlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,16 @@ bool CChainLocksHandler::AlreadyHave(const CInv& inv) const
return seenChainLocks.count(inv.hash) != 0;
}

bool CChainLocksHandler::GetChainLockByHash(const uint256& hash, chainlock::ChainLockSig& ret) const
std::optional<chainlock::ChainLockSig> CChainLocksHandler::GetChainLockByHash(const uint256& hash) const
{
LOCK(cs);

if (hash != bestChainLockHash) {
// we only propagate the best one and ditch all the old ones
return false;
return std::nullopt;
}

ret = bestChainLock;
return true;
return bestChainLock;
}

chainlock::ChainLockSig CChainLocksHandler::GetBestChainLock() const
Expand Down
4 changes: 2 additions & 2 deletions src/chainlock/chainlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <chrono>
#include <map>
#include <memory>
#include <optional>
#include <thread>
#include <unordered_map>

Expand Down Expand Up @@ -91,8 +92,7 @@ class CChainLocksHandler final : public chainlock::ChainLockSignerParent

bool AlreadyHave(const CInv& inv) const
EXCLUSIVE_LOCKS_REQUIRED(!cs);
bool GetChainLockByHash(const uint256& hash, chainlock::ChainLockSig& ret) const
EXCLUSIVE_LOCKS_REQUIRED(!cs);
std::optional<chainlock::ChainLockSig> GetChainLockByHash(const uint256& hash) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
chainlock::ChainLockSig GetBestChainLock() const
EXCLUSIVE_LOCKS_REQUIRED(!cs);
void UpdateTxFirstSeenMap(const Uint256HashSet& tx, const int64_t& time) override EXCLUSIVE_LOCKS_REQUIRED(!cs);
Expand Down
9 changes: 4 additions & 5 deletions src/instantsend/instantsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,10 @@ bool CInstantSendManager::AlreadyHave(const CInv& inv) const
db.KnownInstantSendLock(inv.hash);
}

bool CInstantSendManager::GetInstantSendLockByHash(const uint256& hash, instantsend::InstantSendLock& ret) const
std::optional<instantsend::InstantSendLock> CInstantSendManager::GetInstantSendLockByHash(const uint256& hash) const
{
if (!IsInstantSendEnabled()) {
return false;
return std::nullopt;
}

auto islock = db.GetInstantSendLockByHash(hash);
Expand All @@ -634,12 +634,11 @@ bool CInstantSendManager::GetInstantSendLockByHash(const uint256& hash, instants
if (itNoTx != pendingNoTxInstantSendLocks.end()) {
islock = itNoTx->second.islock;
} else {
return false;
return std::nullopt;
}
}
}
ret = *islock;
return true;
return *islock;
}

instantsend::InstantSendLockPtr CInstantSendManager::GetInstantSendLockByTxid(const uint256& txid) const
Expand Down
3 changes: 2 additions & 1 deletion src/instantsend/instantsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <unordered_lru_cache.h>

#include <atomic>
#include <optional>
#include <unordered_map>
#include <unordered_set>
#include <variant>
Expand Down Expand Up @@ -152,7 +153,7 @@ class CInstantSendManager final : public instantsend::InstantSendSignerParent
void BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected);

bool AlreadyHave(const CInv& inv) const EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingLocks);
bool GetInstantSendLockByHash(const uint256& hash, instantsend::InstantSendLock& ret) const
std::optional<instantsend::InstantSendLock> GetInstantSendLockByHash(const uint256& hash) const
EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingLocks);
instantsend::InstantSendLockPtr GetInstantSendLockByTxid(const uint256& txid) const;

Expand Down
7 changes: 3 additions & 4 deletions src/instantsend/signing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,10 @@ bool InstantSendSigner::TrySignInputLocks(const CTransaction& tx, bool fRetroact
auto id = GenInputLockRequestId(in.prevout);
ids.emplace_back(id);

uint256 otherTxHash;
if (m_sigman.GetVoteForId(params.llmqTypeDIP0024InstantSend, id, otherTxHash)) {
if (otherTxHash != tx.GetHash()) {
if (auto otherTxHashOpt = m_sigman.GetVoteForId(params.llmqTypeDIP0024InstantSend, id)) {
if (*otherTxHashOpt != tx.GetHash()) {
LogPrintf("%s -- txid=%s: input %s is conflicting with previous vote for tx %s\n", __func__,
tx.GetHash().ToString(), in.prevout.ToStringShort(), otherTxHash.ToString());
tx.GetHash().ToString(), in.prevout.ToStringShort(), otherTxHashOpt->ToString());
return false;
}
alreadyVotedCount++;
Expand Down
7 changes: 3 additions & 4 deletions src/llmq/blockprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,15 +720,14 @@ std::optional<CInv> CQuorumBlockProcessor::AddMineableCommitment(const CFinalCom
return relay ? std::make_optional(CInv{MSG_QUORUM_FINAL_COMMITMENT, commitmentHash}) : std::nullopt;
}

bool CQuorumBlockProcessor::GetMineableCommitmentByHash(const uint256& commitmentHash, llmq::CFinalCommitment& ret) const
std::optional<llmq::CFinalCommitment> CQuorumBlockProcessor::GetMineableCommitmentByHash(const uint256& commitmentHash) const
{
LOCK(minableCommitmentsCs);
auto it = minableCommitments.find(commitmentHash);
if (it == minableCommitments.end()) {
return false;
return std::nullopt;
}
ret = it->second;
return true;
return it->second;
}

// Will return nullopt if no commitment should be mined
Expand Down
2 changes: 1 addition & 1 deletion src/llmq/blockprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class CQuorumBlockProcessor
//! it returns hash of commitment if it should be relay, otherwise nullopt
std::optional<CInv> AddMineableCommitment(const CFinalCommitment& fqc) EXCLUSIVE_LOCKS_REQUIRED(!minableCommitmentsCs);
bool HasMineableCommitment(const uint256& hash) const EXCLUSIVE_LOCKS_REQUIRED(!minableCommitmentsCs);
bool GetMineableCommitmentByHash(const uint256& commitmentHash, CFinalCommitment& ret) const
std::optional<CFinalCommitment> GetMineableCommitmentByHash(const uint256& commitmentHash) const
EXCLUSIVE_LOCKS_REQUIRED(!minableCommitmentsCs);
std::optional<std::vector<CFinalCommitment>> GetMineableCommitments(const Consensus::LLMQParams& llmqParams,
int nHeight) const
Expand Down
170 changes: 1 addition & 169 deletions src/llmq/dkgsession.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
#define BITCOIN_LLMQ_DKGSESSION_H

#include <llmq/commitment.h>
#include <llmq/dkgtypes.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can probably drop

#include <bls/bls_ies.h>

and something else once dkgtypes.h is split

@coderabbitai, validate list of included headers for this PR

Copy link
Member Author

Choose a reason for hiding this comment

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

@coderabbitai please review this comment

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

# Check what symbols are used from each include in dkgsession.h
echo "=== Analyzing includes in src/llmq/dkgsession.h ==="
echo

# Check for bls_ies.h usage
echo "1. Checking bls/bls_ies.h usage:"
rg -n "CBLS.*IES|IES.*Recipient" src/llmq/dkgsession.h

echo
echo "2. Checking util/underlying.h usage (ToUnderlying):"
rg -n "ToUnderlying|underlying" src/llmq/dkgsession.h

echo
echo "3. Checking batchedlogger.h usage:"
rg -n "CBatchedLogger" src/llmq/dkgsession.h

echo
echo "4. Checking saltedhasher.h usage:"
rg -n "Salted|Uint256HashSet" src/llmq/dkgsession.h

echo
echo "5. Checking what dkgtypes.h defines:"
cat src/llmq/dkgtypes.h | head -50

echo
echo "6. Checking if any types from dkgtypes.h are forward-declarable:"
rg -n "CDKG(Contribution|Complaint|Justification|PrematureCommitment)" src/llmq/dkgsession.h

echo
echo "7. Check includes in dkgtypes.h:"
rg "^#include" src/llmq/dkgtypes.h

Length of output: 3176


@PastaPastaPasta, @knst is correct! After analyzing the includes in src/llmq/dkgsession.h, I can confirm that the following includes are now redundant and can be removed:

  1. #include <bls/bls_ies.h> - This can be dropped because:

    • It's used for CBLSIESMultiRecipientObjects<CBLSSecretKey> (line 144)
    • However, dkgtypes.h already includes bls/bls_ies.h
    • The type will be available transitively through dkgtypes.h
  2. #include <util/underlying.h> - This can be dropped because:

    • It's not directly used anywhere in dkgsession.h
    • dkgtypes.h already includes it
    • If needed in the future, it's available transitively

Current necessary includes:

  • llmq/commitment.h - used for CFinalCommitment
  • llmq/dkgtypes.h - provides CDKGContribution, CDKGComplaint, CDKGJustification, CDKGPrematureCommitment (stored as full objects in std::map members, can't be forward-declared)
  • batchedlogger.h - base class for CDKGLogger
  • bls/bls.h - BLS types (CBLSId, CBLSSecretKey, BLSVerificationVectorPtr, etc.)
  • bls/bls_worker.h - CBLSWorker& member
  • evo/types.h - CDeterministicMN types
  • saltedhasher.h - Uint256HashSet type
  • sync.h - Mutex, GUARDED_BY
  • optional - std::optional usage
  • unordered_set - std::unordered_set

Would you like me to create an issue to track the removal of these redundant includes?


🧬 Code Graph Analysis Results
  • File: src/llmq/dkgsessionmgr.h

    • Snippet (32-61)
    • Content: Contributions cache key/entry types and their usage:
      • ContributionsCacheKey (llmqType, quorumHash, proTxHash) with operator<
      • ContributionsCacheEntry (entryTime, vvec, skContribution)
      • Contributes a thread-safe cache for verified contributions and SK contributions, guarded by contributionsCacheCs
    • Rationale: Helps understand how CDKGSessionManager caches verified contributions and SK shares for DKG sessions.
  • File: src/llmq/dkgsessionhandler.h

    • Snippet (65-208)
    • Content: CDKGPendingMessages class
      • Manages per-node pending messages (contributions, complaints, justifications, premature commitments)
      • Synchronization via cs_messages
      • Methods to PushPendingMessage, PopPendingMessages, HasSeen, Misbehaving, Clear
      • Template helper to PushPendingMessage and to PopAndDeserializeMessages
    • Rationale: Explains how a quorum session queues and processes batched DKG messages before full verification.
  • File: src/llmq/dkgsession.h

    • Snippet (not a separate file; reference for context)
    • Content: CDKGLogger forward usage
    • Rationale: Provides context for how logging is associated with a CDKGSession instance.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::CDKGSession constructor) - Line ~70-88
    • Content: CDKGSession constructor initializes DKG session with parameters, blsWorker, managers, and session state
    • Rationale: Shows how a DKG session is instantiated, which informs how the rest of the session lifecycle is expected to operate.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::Contribute) - Line ~157-178
    • Content: Generating contributions via blsWorker and preparing to send
    • Rationale: Core step of Phase 1; helps understand how local contributions are created.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::SendContributions) - Line ~180-230
    • Content: Building, encrypting, signing and sending own contributions
    • Rationale: Critical for understanding how a member’s contribution is prepared and distributed.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::PreVerifyMessage for CDKGContribution) - Line ~233-277
    • Content: Validation logic for incoming contributions (quorum hash, member validation, vector lengths, verification)
    • Rationale: Key for understanding pre-verification checks before deeper processing.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::ReceiveMessage for CDKGContribution) - Line ~280-360
    • Content: Handling of received contributions, decryption path, verification queuing, and relay logic
    • Rationale: Details on how contributions are accepted, decrypted, and propagated.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::PreVerifyMessage for CDKGComplaint) - Line ~550-590
    • Content: Validation logic for complaints (quorum hash, member validity, bad/complaint counts)
    • Rationale: Clarifies pre-verification rules for complaints.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::ReceiveMessage for CDKGComplaint) - Line ~592-651
    • Content: Handling of received complaints, relay, and member state updates
    • Rationale: Explains how complaints are recorded and relayed.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::PreVerifyMessage for CDKGJustification) - Line ~744-800
    • Content: Validation logic for justifications (quorum hash, member, contributions, and counts)
    • Rationale: Details pre-verification for justifications.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::ReceiveMessage for CDKGJustification) - Line ~802-892
    • Content: Handling of justified shares, verification of contributions, and updating state
    • Rationale: Explains how justifications are processed and how SK contributions are integrated.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::ReceiveMessage for CDKGPrematureCommitment) - Line ~1113-1188
    • Content: Premature commitment handling, vector verification, and relay logic
    • Rationale: Clarifies how premature commitments are validated and relayed.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::ReceiveMessage for CDKGPrematureCommitment) - Line ~1113-1113
    • Content: Specific entry point for premature commitment receive
    • Rationale: Quick anchor for premature commitment handling.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::FinalizeCommitments) - Line ~1190-1297
    • Content: Aggregation of valid premature commitments into final quorums
    • Rationale: Central to producing final commitments.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::FinalizeSingleCommitment) - Line ~1299-1355
    • Content: Single-node quorum finalization path
    • Rationale: Explains fallback/single-member signing scenario.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::MarkBadMember) - Line ~1366-1366
    • Content: Marking a member as bad and logging status
    • Rationale: Important for understanding how misbehaving members are tracked.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::GetMember) - Line ~1357-1357
    • Content: Lookup member by proTxHash
    • Rationale: Member lookup utility used throughout processing.
  • File: src/llmq/dkgsession.cpp

    • Snippet (CDKGSession::ShouldSimulateError) - Line ~53-60
    • Content: Determines whether to simulate DKG errors for test quorums
    • Rationale: Relevant for tests and understanding error injection
  • File: src/llmq/dkgsession.cpp

    • Snippet (SetSimulatedDKGErrorRate / GetSimulatedErrorRate) - Lines 41-51 and 47-47
    • Content: Global helpers to configure/get simulated error rates
    • Rationale: Context for how error rates are controlled in tests
  • File: src/llmq/signing_shares.h (contextual; not from dkgsession.h)

    • Snippet (CBatchedSigShares and SigShareMap usage)
    • Content: Structures used for batched signature shares
    • Rationale: Helpful for understanding how sigShares are aggregated in DKG flows
  • File: src/llmq/params.h (contextual)

    • Snippet (LLMQParams basics and available_llmqs)
    • Content: Definitions of LLMQ types, parameters, and rotation behavior
    • Rationale: Provides context for how DKG sessions are configured; relevant to interpretation of CDKGSession behavior

Note: If you want, I can extract and present any of these snippets in full from the provided references, or tailor a focused subset to a specific area of interest (e.g., contribution flow, verification flow, or finalization).


🧠 Learnings used
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.

Learnt from: kwvg
Repo: dashpay/dash PR: 6761
File: src/wallet/wallet.cpp:0-0
Timestamp: 2025-07-29T14:33:01.040Z
Learning: In refactoring PRs like #6761, kwvg acknowledges code safety improvements (like null pointer checks and unused parameter warnings) but prefers to defer them to follow-up PRs to maintain focus on the primary refactoring objectives, avoiding scope creep.

Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.


#include <batchedlogger.h>
#include <bls/bls.h>
#include <bls/bls_ies.h>
#include <bls/bls_worker.h>
#include <evo/types.h>

#include <saltedhasher.h>
#include <sync.h>
#include <util/underlying.h>

#include <optional>
#include <unordered_set>
Expand All @@ -38,173 +37,6 @@ class CDKGSessionManager;
class CDKGPendingMessages;
class CQuorumSnapshotManager;

class CDKGContribution
{
public:
Consensus::LLMQType llmqType;
uint256 quorumHash;
uint256 proTxHash;
BLSVerificationVectorPtr vvec;
std::shared_ptr<CBLSIESMultiRecipientObjects<CBLSSecretKey>> contributions;
CBLSSignature sig;

public:
template<typename Stream>
inline void SerializeWithoutSig(Stream& s) const
{
s << ToUnderlying(llmqType);
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)
{
std::vector<CBLSPublicKey> tmp1;
CBLSIESMultiRecipientObjects<CBLSSecretKey> tmp2;

s >> llmqType;
s >> quorumHash;
s >> proTxHash;
s >> tmp1;
s >> tmp2;
s >> sig;

vvec = std::make_shared<std::vector<CBLSPublicKey>>(std::move(tmp1));
contributions = std::make_shared<CBLSIESMultiRecipientObjects<CBLSSecretKey>>(std::move(tmp2));
}

[[nodiscard]] uint256 GetSignHash() const
{
CHashWriter hw(SER_GETHASH, 0);
SerializeWithoutSig(hw);
hw << CBLSSignature();
return hw.GetHash();
}
};

class CDKGComplaint
{
public:
Consensus::LLMQType llmqType{Consensus::LLMQType::LLMQ_NONE};
uint256 quorumHash;
uint256 proTxHash;
std::vector<bool> badMembers;
std::vector<bool> complainForMembers;
CBLSSignature sig;

public:
CDKGComplaint() = default;
explicit CDKGComplaint(const Consensus::LLMQParams& params) :
badMembers((size_t)params.size), complainForMembers((size_t)params.size) {};

SERIALIZE_METHODS(CDKGComplaint, obj)
{
READWRITE(
obj.llmqType,
obj.quorumHash,
obj.proTxHash,
DYNBITSET(obj.badMembers),
DYNBITSET(obj.complainForMembers),
obj.sig
);
}

[[nodiscard]] uint256 GetSignHash() const
{
CDKGComplaint tmp(*this);
tmp.sig = CBLSSignature();
return ::SerializeHash(tmp);
}
};

class CDKGJustification
{
public:
Consensus::LLMQType llmqType;
uint256 quorumHash;
uint256 proTxHash;
struct Contribution {
uint32_t index;
CBLSSecretKey key;
SERIALIZE_METHODS(Contribution, obj)
{
READWRITE(obj.index, obj.key);
}
};
std::vector<Contribution> contributions;
CBLSSignature sig;

public:
SERIALIZE_METHODS(CDKGJustification, obj)
{
READWRITE(obj.llmqType, obj.quorumHash, obj.proTxHash, obj.contributions, obj.sig);
}

[[nodiscard]] uint256 GetSignHash() const
{
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:
Consensus::LLMQType llmqType{Consensus::LLMQType::LLMQ_NONE};
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:
CDKGPrematureCommitment() = default;
explicit CDKGPrematureCommitment(const Consensus::LLMQParams& params) :
validMembers((size_t)params.size) {};

[[nodiscard]] int CountValidMembers() const
{
return int(std::count(validMembers.begin(), validMembers.end(), true));
}

public:
SERIALIZE_METHODS(CDKGPrematureCommitment, obj)
{
READWRITE(
obj.llmqType,
obj.quorumHash,
obj.proTxHash,
DYNBITSET(obj.validMembers),
obj.quorumPublicKey,
obj.quorumVvecHash,
obj.quorumSig,
obj.sig
);
}

[[nodiscard]] uint256 GetSignHash() const
{
return BuildCommitmentHash(llmqType, quorumHash, validMembers, quorumPublicKey, quorumVvecHash);
}
};

class CDKGMember
{
public:
Expand Down
28 changes: 12 additions & 16 deletions src/llmq/dkgsessionhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,48 +627,44 @@ void CDKGSessionHandler::PhaseHandlerThread(CConnman& connman, PeerManager& peer
}
}

bool CDKGSessionHandler::GetContribution(const uint256& hash, CDKGContribution& ret) const
std::optional<CDKGContribution> CDKGSessionHandler::GetContribution(const uint256& hash) const
{
LOCK(curSession->invCs);
auto it = curSession->contributions.find(hash);
if (it != curSession->contributions.end()) {
ret = it->second;
return true;
return it->second;
}
return false;
return std::nullopt;
}

bool CDKGSessionHandler::GetComplaint(const uint256& hash, CDKGComplaint& ret) const
std::optional<CDKGComplaint> CDKGSessionHandler::GetComplaint(const uint256& hash) const
{
LOCK(curSession->invCs);
auto it = curSession->complaints.find(hash);
if (it != curSession->complaints.end()) {
ret = it->second;
return true;
return it->second;
}
return false;
return std::nullopt;
}

bool CDKGSessionHandler::GetJustification(const uint256& hash, CDKGJustification& ret) const
std::optional<CDKGJustification> CDKGSessionHandler::GetJustification(const uint256& hash) const
{
LOCK(curSession->invCs);
auto it = curSession->justifications.find(hash);
if (it != curSession->justifications.end()) {
ret = it->second;
return true;
return it->second;
}
return false;
return std::nullopt;
}

bool CDKGSessionHandler::GetPrematureCommitment(const uint256& hash, CDKGPrematureCommitment& ret) const
std::optional<CDKGPrematureCommitment> CDKGSessionHandler::GetPrematureCommitment(const uint256& hash) const
{
LOCK(curSession->invCs);
auto it = curSession->prematureCommitments.find(hash);
if (it != curSession->prematureCommitments.end() && curSession->validCommitments.count(hash)) {
ret = it->second;
return true;
return it->second;
}
return false;
return std::nullopt;
}

} // namespace llmq
Loading
Loading