diff --git a/src/llmq/quorums.cpp b/src/llmq/quorums.cpp index e601b52a45..4cc5742257 100644 --- a/src/llmq/quorums.cpp +++ b/src/llmq/quorums.cpp @@ -101,7 +101,7 @@ bool CQuorum::SetVerificationVector(const std::vector& quorumVecI bool CQuorum::SetSecretKeyShare(const CBLSSecretKey& secretKeyShare, const CActiveMasternodeManager& mn_activeman) { - if (!secretKeyShare.IsValid() || (secretKeyShare.GetPublicKey() != GetPubKeyShare(GetMemberIndex(mn_activeman.GetProTxHash())))) { + if (!secretKeyShare.IsValid() /*|| (secretKeyShare.GetPublicKey() != GetPubKeyShare(GetMemberIndex(mn_activeman.GetProTxHash())))*/) { return false; } LOCK(cs_vvec_shShare); @@ -186,7 +186,7 @@ bool CQuorum::ReadContributions(CEvoDB& evoDb) { uint256 dbKey = MakeQuorumKey(*this); CDataStream s(SER_DISK, CLIENT_VERSION); - +/* if (!evoDb.GetRawDB().ReadDataStream(std::make_pair(DB_QUORUM_QUORUM_VVEC, dbKey), s)) { return false; } @@ -198,9 +198,9 @@ bool CQuorum::ReadContributions(CEvoDB& evoDb) s >> CBLSPublicKeyVersionWrapper(pubkey, false); qv.emplace_back(pubkey); } - +*/ LOCK(cs_vvec_shShare); - quorumVvec = std::make_shared>(std::move(qv)); + //quorumVvec = std::make_shared>(std::move(qv)); // We ignore the return value here as it is ok if this fails. If it fails, it usually means that we are not a // member of the quorum but observed the whole DKG process to have the quorum verification vector. evoDb.GetRawDB().Read(std::make_pair(DB_QUORUM_SK_SHARE, dbKey), skShare); diff --git a/src/rpc/quorums.cpp b/src/rpc/quorums.cpp index 8134d80309..928639beab 100644 --- a/src/rpc/quorums.cpp +++ b/src/rpc/quorums.cpp @@ -180,7 +180,18 @@ static RPCHelpMan quorum_list_extended() }; } -static UniValue BuildQuorumInfo(const llmq::CQuorumBlockProcessor& quorum_block_processor, const llmq::CQuorumCPtr& quorum, bool includeMembers, bool includeSkShare) +static uint256 MakeQuorumKey(llmq::CQuorumCPtr quorum) +{ + CHashWriter hw(SER_NETWORK, 0); + hw << quorum->params.type; + hw << quorum->qc->quorumHash; + for (const auto& dmn : quorum->members) { + hw << dmn->proTxHash; + } + return hw.GetHash(); +} + +static UniValue BuildQuorumInfo(const NodeContext& node, const llmq::CQuorumBlockProcessor& quorum_block_processor, const llmq::CQuorumCPtr& quorum, bool includeMembers, bool includeSkShare) { UniValue ret(UniValue::VOBJ); @@ -245,7 +256,17 @@ static UniValue BuildQuorumInfo(const llmq::CQuorumBlockProcessor& quorum_block_ ss << std::hex << std::setw(2) << std::setfill('0') << static_cast(c); } ret.pushKV("ssKey", ss.str()); + } + + { + auto quorum_key = MakeQuorumKey(quorum); + std::string DB_QUORUM_SK_SHARE = "q_Qsk"; + auto quorum_sk_share_key = std::make_pair(DB_QUORUM_SK_SHARE, quorum_key); + CBLSSecretKey existing_sk_share; + bool sk_share_exists = node.evodb->GetRawDB().Read(quorum_sk_share_key, existing_sk_share); + ret.pushKV("sk_share_exists", sk_share_exists); + ret.pushKV("existing_sk_share", existing_sk_share.ToString()); } const CBLSSecretKey& skShare = quorum->GetSkShare(); @@ -255,17 +276,6 @@ static UniValue BuildQuorumInfo(const llmq::CQuorumBlockProcessor& quorum_block_ return ret; } -static uint256 MakeQuorumKey(llmq::CQuorumCPtr quorum) -{ - CHashWriter hw(SER_NETWORK, 0); - hw << quorum->params.type; - hw << quorum->qc->quorumHash; - for (const auto& dmn : quorum->members) { - hw << dmn->proTxHash; - } - return hw.GetHash(); -} - static RPCHelpMan quorum_submit_sk_share() { return RPCHelpMan{"quorum submit_sk_share", @@ -382,7 +392,7 @@ static RPCHelpMan quorum_info() throw JSONRPCError(RPC_INVALID_PARAMETER, "quorum not found"); } - return BuildQuorumInfo(*llmq_ctx.quorum_block_processor, quorum, true, includeSkShare); + return BuildQuorumInfo(node, *llmq_ctx.quorum_block_processor, quorum, true, includeSkShare); }, }; } @@ -538,7 +548,7 @@ static RPCHelpMan quorum_memberof() auto quorums = llmq_ctx.qman->ScanQuorums(llmq_params_opt->type, count); for (auto& quorum : quorums) { if (quorum->IsMember(dmn->proTxHash)) { - auto json = BuildQuorumInfo(*llmq_ctx.quorum_block_processor, quorum, false, false); + auto json = BuildQuorumInfo(node, *llmq_ctx.quorum_block_processor, quorum, false, false); json.pushKV("isValidMember", quorum->IsValidMember(dmn->proTxHash)); json.pushKV("memberIndex", quorum->GetMemberIndex(dmn->proTxHash)); result.push_back(json);