@@ -70,10 +70,9 @@ std::string CSigSharesInv::ToString() const
70
70
return str;
71
71
}
72
72
73
- void CSigSharesInv::Init (Consensus::LLMQType _llmqType )
73
+ void CSigSharesInv::Init (size_t size )
74
74
{
75
- size_t llmqSize = (size_t )(Params ().GetConsensus ().llmqs .at (_llmqType).size );
76
- inv.resize (llmqSize, false );
75
+ inv.resize (size, false );
77
76
}
78
77
79
78
bool CSigSharesInv::IsSet (uint16_t quorumMember) const
@@ -88,27 +87,30 @@ void CSigSharesInv::Set(uint16_t quorumMember, bool v)
88
87
inv[quorumMember] = v;
89
88
}
90
89
91
- CSigSharesInv CBatchedSigShares::ToInv (Consensus::LLMQType llmqType ) const
90
+ std::string CBatchedSigShares::ToInvString ( ) const
92
91
{
93
92
CSigSharesInv inv;
94
- inv.Init (llmqType);
93
+ // we use 400 here no matter what the real size is. We don't really care about that size as we just want to call ToString()
94
+ inv.Init (400 );
95
95
for (size_t i = 0 ; i < sigShares.size (); i++) {
96
96
inv.inv [sigShares[i].first ] = true ;
97
97
}
98
- return inv;
98
+ return inv. ToString () ;
99
99
}
100
100
101
101
template <typename T>
102
102
static void InitSession (CSigSharesNodeState::Session& s, const uint256& signHash, T& from)
103
103
{
104
+ const auto & params = Params ().GetConsensus ().llmqs .at ((Consensus::LLMQType)from.llmqType );
105
+
104
106
s.llmqType = (Consensus::LLMQType)from.llmqType ;
105
107
s.quorumHash = from.quorumHash ;
106
108
s.id = from.id ;
107
109
s.msgHash = from.msgHash ;
108
110
s.signHash = signHash;
109
- s.announced .Init ((Consensus::LLMQType)from. llmqType );
110
- s.requested .Init ((Consensus::LLMQType)from. llmqType );
111
- s.knows .Init ((Consensus::LLMQType)from. llmqType );
111
+ s.announced .Init ((size_t )params. size );
112
+ s.requested .Init ((size_t )params. size );
113
+ s.knows .Init ((size_t )params. size );
112
114
}
113
115
114
116
CSigSharesNodeState::Session& CSigSharesNodeState::GetOrCreateSessionFromShare (const llmq::CSigShare& sigShare)
@@ -435,8 +437,8 @@ bool CSigSharesManager::ProcessMessageBatchedSigShares(CNode* pfrom, const CBatc
435
437
}
436
438
}
437
439
438
- LogPrintf ( " llmq " , " CSigSharesManager::%s -- signHash=%s, shares=%d, new=%d, inv={%s}, node=%d\n " , __func__,
439
- sessionInfo.signHash .ToString (), batchedSigShares.sigShares .size (), sigShares.size (), batchedSigShares.ToInv (sessionInfo. llmqType ). ToString (), pfrom->GetId ());
440
+ LogPrint (BCLog::LLMQ , " CSigSharesManager::%s -- signHash=%s, shares=%d, new=%d, inv={%s}, node=%d\n " , __func__,
441
+ sessionInfo.signHash .ToString (), batchedSigShares.sigShares .size (), sigShares.size (), batchedSigShares.ToInvString (), pfrom->GetId ());
440
442
441
443
if (sigShares.empty ()) {
442
444
return true ;
@@ -862,7 +864,8 @@ void CSigSharesManager::CollectSigSharesToRequest(std::unordered_map<NodeId, std
862
864
}
863
865
auto & inv = (*invMap)[signHash];
864
866
if (inv.inv .empty ()) {
865
- inv.Init (session.llmqType );
867
+ const auto & params = Params ().GetConsensus ().llmqs .at ((Consensus::LLMQType)session.llmqType );
868
+ inv.Init ((size_t )params.size );
866
869
}
867
870
inv.inv [k.second ] = true ;
868
871
@@ -974,7 +977,8 @@ void CSigSharesManager::CollectSigSharesToAnnounce(std::unordered_map<NodeId, st
974
977
975
978
auto & inv = sigSharesToAnnounce[nodeId][signHash];
976
979
if (inv.inv .empty ()) {
977
- inv.Init ((Consensus::LLMQType)sigShare->llmqType );
980
+ const auto & params = Params ().GetConsensus ().llmqs .at ((Consensus::LLMQType)sigShare->llmqType );
981
+ inv.Init ((size_t )params.size );
978
982
}
979
983
inv.inv [quorumMember] = true ;
980
984
session.knows .inv [quorumMember] = true ;
@@ -1093,14 +1097,8 @@ bool CSigSharesManager::SendMessages()
1093
1097
std::vector<CBatchedSigShares> msgs;
1094
1098
for (auto & p : jt->second ) {
1095
1099
assert (!p.second .sigShares .empty ());
1096
- if (LogAcceptCategory (BCLog::LogFlags::LLMQ)) {
1097
- LOCK (cs);
1098
- auto session = nodeStates[pnode->GetId ()].GetSessionBySignHash (p.first );
1099
- assert (session);
1100
- LogPrintf (" llmq" , " CSigSharesManager::SendMessages -- QBSIGSHARES signHash=%s, inv={%s}, node=%d\n " ,
1101
- p.first .ToString (), p.second .ToInv (session->llmqType ).ToString (), pnode->GetId ());
1102
- }
1103
-
1100
+ LogPrint (BCLog::LLMQ, " CSigSharesManager::SendMessages -- QBSIGSHARES signHash=%s, inv={%s}, node=%d\n " ,
1101
+ p.first .ToString (), p.second .ToInvString (), pnode->GetId ());
1104
1102
if (totalSigsCount + p.second .sigShares .size () > MAX_MSGS_TOTAL_BATCHED_SIGS) {
1105
1103
g_connman->PushMessage (pnode, msgMaker.Make (NetMsgType::QBSIGSHARES, msgs));
1106
1104
msgs.clear ();
0 commit comments