You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 40d714a
Browse filesBrowse the repository at this point in the historyBrowse files
refactor: route per-LLMQ-type caches through PerLlmqTypeCache
Consensus::LLMQType is a uint8_t enum that arrives verbatim over the wire, and the LRU caches keyed by it are only pre-seeded with the types in Params().GetConsensus().llmqs. Indexing one of those std::maps with operator[] on an unregistered key default-constructs an unordered_lru_cache with MaxSize = 0, whose constructor asserts; util/check.h makes compiling with NDEBUG a hard #error, so that assert is live in release builds.
The QSIGSHARE handler gate and find()-guarded lookups this branch originally carried landed separately in v23.1.8 (a801d3f) and reached develop via the master back-merge, so this is now the follow-up hardening rather than the fix itself. That fix guarded only the two lookups a QSIGSHARE could reach; every other map keyed by LLMQ type still used operator[].
Replace them all with PerLlmqTypeCache, which owns one LRU per registered type and answers unregistered types as misses, so no caller can size a zero-capacity cache into existence. This covers mapHasMinedCommitmentCache, m_qc_hashes_lru, mapQuorumsCache, scanQuorumsCache, cleanupQuorumsCache, indexed_quorums_cache, mapQuorumMembers and mapIndexedQuorumMembers, and lets InitQuorumsCache go away.
Extend llmq_invalid_type_tests to pin the cache contract itself plus the QSIGSHARE ban. The ban needs its own test because no cache-level assertion can catch its removal: ProcessMessageSigShare returns true when GetQuorum yields nullptr, so without the gate the peer is dropped silently and never scored.
0 commit comments