@@ -778,6 +778,25 @@ void CSigSharesManager::TryRecoverSig(PeerManager& peerman, const CQuorumCPtr& q
778778 return ;
779779 }
780780
781+ if (quorum->params .size == 1 ) {
782+ if (sigSharesForSignHash->empty ()) {
783+ LogPrint (BCLog::LLMQ_SIGS, /* Continued */
784+ " CSigSharesManager::%s -- impossible to recover single-node signature - no shares yet. id=%s, "
785+ " msgHash=%s\n " ,
786+ __func__, id.ToString (), msgHash.ToString ());
787+ return ;
788+ }
789+ const auto & sigShare = sigSharesForSignHash->begin ()->second ;
790+ CBLSSignature recoveredSig = sigShare.sigShare .Get ();
791+ LogPrint (BCLog::LLMQ_SIGS, " CSigSharesManager::%s -- recover single-node signature. id=%s, msgHash=%s\n " ,
792+ __func__, id.ToString (), msgHash.ToString ());
793+
794+ auto rs = std::make_shared<CRecoveredSig>(quorum->params .type , quorum->qc ->quorumHash , id, msgHash,
795+ recoveredSig);
796+ sigman.ProcessRecoveredSig (rs, peerman);
797+ return ; // end of single-quorum processing
798+ }
799+
781800 sigSharesForRecovery.reserve ((size_t ) quorum->params .threshold );
782801 idsForRecovery.reserve ((size_t ) quorum->params .threshold );
783802 for (auto it = sigSharesForSignHash->begin (); it != sigSharesForSignHash->end () && sigSharesForRecovery.size () < size_t (quorum->params .threshold ); ++it) {
@@ -1524,6 +1543,37 @@ std::optional<CSigShare> CSigSharesManager::CreateSigShare(const CQuorumCPtr& qu
15241543 return std::nullopt ;
15251544 }
15261545
1546+ if (quorum->params .size == 1 ) {
1547+ int memberIdx = quorum->GetMemberIndex (activeMasterNodeProTxHash);
1548+ if (memberIdx == -1 ) {
1549+ // this should really not happen (IsValidMember gave true)
1550+ return std::nullopt ;
1551+ }
1552+
1553+ CSigShare sigShare (quorum->params .type , quorum->qc ->quorumHash , id, msgHash, uint16_t (memberIdx), {});
1554+ uint256 signHash = sigShare.buildSignHash ();
1555+
1556+ // TODO: This one should be SIGN by QUORUM key, not by OPERATOR key
1557+ // see TODO in CDKGSession::FinalizeSingleCommitment for details
1558+ sigShare.sigShare .Set (m_mn_activeman->Sign (signHash, bls::bls_legacy_scheme.load ()), bls::bls_legacy_scheme.load ());
1559+
1560+ if (!sigShare.sigShare .Get ().IsValid ()) {
1561+ LogPrintf (" CSigSharesManager::%s -- failed to sign sigShare. signHash=%s, id=%s, msgHash=%s, time=%s\n " ,
1562+ __func__, signHash.ToString (), sigShare.getId ().ToString (), sigShare.getMsgHash ().ToString (),
1563+ t.count ());
1564+ return std::nullopt ;
1565+ }
1566+
1567+ sigShare.UpdateKey ();
1568+
1569+ LogPrint (BCLog::LLMQ_SIGS, /* Continued */
1570+ " CSigSharesManager::%s -- created sigShare. signHash=%s, id=%s, msgHash=%s, llmqType=%d, quorum=%s, "
1571+ " time=%s\n " ,
1572+ __func__, signHash.ToString (), sigShare.getId ().ToString (), sigShare.getMsgHash ().ToString (),
1573+ ToUnderlying (quorum->params .type ), quorum->qc ->quorumHash .ToString (), t.count ());
1574+
1575+ return sigShare;
1576+ }
15271577 const CBLSSecretKey& skShare = quorum->GetSkShare ();
15281578 if (!skShare.IsValid ()) {
15291579 LogPrint (BCLog::LLMQ_SIGS, " CSigSharesManager::%s -- we don't have our skShare for quorum %s\n " , __func__, quorum->qc ->quorumHash .ToString ());
0 commit comments