diff --git a/src/llmq/quorums.cpp b/src/llmq/quorums.cpp index 15747ad1b18bc2..71695c70d71300 100644 --- a/src/llmq/quorums.cpp +++ b/src/llmq/quorums.cpp @@ -132,7 +132,7 @@ bool CQuorum::IsValidMember(const uint256& proTxHash) const CBLSPublicKey CQuorum::GetPubKeyShare(size_t memberIdx) const { LOCK(cs_vvec_shShare); - if (!HasVerificationVector() || memberIdx >= members.size() || !qc->validMembers[memberIdx]) { + if (!HasVerificationVectorInternal() || memberIdx >= members.size() || !qc->validMembers[memberIdx]) { return CBLSPublicKey(); } const auto& m = members[memberIdx]; @@ -141,6 +141,11 @@ CBLSPublicKey CQuorum::GetPubKeyShare(size_t memberIdx) const bool CQuorum::HasVerificationVector() const { LOCK(cs_vvec_shShare); + return HasVerificationVectorInternal(); +} + +bool CQuorum::HasVerificationVectorInternal() const { + AssertLockHeld(cs_vvec_shShare); return quorumVvec != nullptr; } @@ -166,7 +171,7 @@ void CQuorum::WriteContributions(CEvoDB& evoDb) const uint256 dbKey = MakeQuorumKey(*this); LOCK(cs_vvec_shShare); - if (HasVerificationVector()) { + if (HasVerificationVectorInternal()) { CDataStream s(SER_DISK, CLIENT_VERSION); WriteCompactSize(s, quorumVvec->size()); for (auto& pubkey : *quorumVvec) { diff --git a/src/llmq/quorums.h b/src/llmq/quorums.h index a309ed192d41f0..890b52fd268ed1 100644 --- a/src/llmq/quorums.h +++ b/src/llmq/quorums.h @@ -199,7 +199,7 @@ class CQuorum } bool SetSecretKeyShare(const CBLSSecretKey& secretKeyShare); - bool HasVerificationVector() const; + bool HasVerificationVector() const LOCKS_EXCLUDED(cs_vvec_shShare); bool IsMember(const uint256& proTxHash) const; bool IsValidMember(const uint256& proTxHash) const; int GetMemberIndex(const uint256& proTxHash) const; @@ -208,6 +208,7 @@ class CQuorum CBLSSecretKey GetSkShare() const; private: + bool HasVerificationVectorInternal() const EXCLUSIVE_LOCKS_REQUIRED(cs_vvec_shShare); void WriteContributions(CEvoDB& evoDb) const; bool ReadContributions(CEvoDB& evoDb); };