Skip to content

Commit c452f88

Browse files
committed
refactor: leftover usages that has not been replaced by automatic script
1 parent 85e6af4 commit c452f88

File tree

11 files changed

+25
-23
lines changed

11 files changed

+25
-23
lines changed

src/evo/cbtx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ auto CachedGetQcHashesQcIndexedHashes(const CBlockIndex* pindexPrev, const llmq:
5858

5959
static Mutex cs_cache;
6060
static std::map<Consensus::LLMQType, std::vector<const CBlockIndex*>> quorums_cached GUARDED_BY(cs_cache);
61-
static std::map<Consensus::LLMQType, unordered_lru_cache<uint256, std::pair<uint256, int>, StaticSaltedHasher>> qc_hashes_cached
61+
static std::map<Consensus::LLMQType, Uint256LruHashMap<std::pair<uint256, int>>> qc_hashes_cached
6262
GUARDED_BY(cs_cache);
6363
static QcHashMap qcHashes_cached GUARDED_BY(cs_cache);
6464
static QcIndexedHashMap qcIndexedHashes_cached GUARDED_BY(cs_cache);

src/instantsend/db.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class CInstantSendDb
3636
int best_confirmed_height GUARDED_BY(cs_db){0};
3737

3838
std::unique_ptr<CDBWrapper> db GUARDED_BY(cs_db){nullptr};
39-
mutable unordered_lru_cache<uint256, InstantSendLockPtr, StaticSaltedHasher, 10000> islockCache GUARDED_BY(cs_db);
40-
mutable unordered_lru_cache<uint256, uint256, StaticSaltedHasher, 10000> txidCache GUARDED_BY(cs_db);
39+
mutable Uint256LruHashMap<InstantSendLockPtr, 10000> islockCache GUARDED_BY(cs_db);
40+
mutable Uint256LruHashMap<uint256, 10000> txidCache GUARDED_BY(cs_db);
4141

4242
mutable unordered_lru_cache<COutPoint, uint256, SaltedOutpointHasher, 10000> outpointCache GUARDED_BY(cs_db);
4343
void WriteInstantSendLockMined(CDBBatch& batch, const uint256& hash, int nHeight) EXCLUSIVE_LOCKS_REQUIRED(cs_db);

src/instantsend/instantsend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ instantsend::PendingState CInstantSendManager::ProcessPendingInstantSendLocks()
232232

233233
Uint256HashSet CInstantSendManager::ProcessPendingInstantSendLocks(
234234
const Consensus::LLMQParams& llmq_params, int signOffset, bool ban,
235-
const std::unordered_map<uint256, std::pair<NodeId, instantsend::InstantSendLockPtr>, StaticSaltedHasher>& pend,
235+
const Uint256HashMap<std::pair<NodeId, instantsend::InstantSendLockPtr>>& pend,
236236
std::vector<std::pair<NodeId, MessageProcessingResult>>& peer_activity)
237237
{
238238
CBLSBatchVerifier<NodeId, uint256> batchVerifier(false, true, 8);

src/instantsend/instantsend.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ class CInstantSendManager final : public instantsend::InstantSendSignerParent
6666

6767
mutable Mutex cs_pendingLocks;
6868
// Incoming and not verified yet
69-
std::unordered_map<uint256, std::pair<NodeId, instantsend::InstantSendLockPtr>, StaticSaltedHasher> pendingInstantSendLocks GUARDED_BY(cs_pendingLocks);
69+
Uint256HashMap<std::pair<NodeId, instantsend::InstantSendLockPtr>> pendingInstantSendLocks GUARDED_BY(cs_pendingLocks);
7070
// Tried to verify but there is no tx yet
71-
std::unordered_map<uint256, std::pair<NodeId, instantsend::InstantSendLockPtr>, StaticSaltedHasher> pendingNoTxInstantSendLocks GUARDED_BY(cs_pendingLocks);
71+
Uint256HashMap<std::pair<NodeId, instantsend::InstantSendLockPtr>> pendingNoTxInstantSendLocks GUARDED_BY(cs_pendingLocks);
7272

7373
// TXs which are neither IS locked nor ChainLocked. We use this to determine for which TXs we need to retry IS
7474
// locking of child TXs
@@ -86,7 +86,7 @@ class CInstantSendManager final : public instantsend::InstantSendSignerParent
8686
Uint256HashSet pendingRetryTxs GUARDED_BY(cs_pendingRetry);
8787

8888
mutable Mutex cs_timingsTxSeen;
89-
std::unordered_map<uint256, int64_t, StaticSaltedHasher> timingsTxSeen GUARDED_BY(cs_timingsTxSeen);
89+
Uint256HashMap<int64_t> timingsTxSeen GUARDED_BY(cs_timingsTxSeen);
9090

9191
public:
9292
explicit CInstantSendManager(CChainLocksHandler& _clhandler, CChainState& chainstate, CQuorumManager& _qman,
@@ -112,7 +112,7 @@ class CInstantSendManager final : public instantsend::InstantSendSignerParent
112112

113113
Uint256HashSet ProcessPendingInstantSendLocks(
114114
const Consensus::LLMQParams& llmq_params, int signOffset, bool ban,
115-
const std::unordered_map<uint256, std::pair<NodeId, instantsend::InstantSendLockPtr>, StaticSaltedHasher>& pend,
115+
const Uint256HashMap<std::pair<NodeId, instantsend::InstantSendLockPtr>>& pend,
116116
std::vector<std::pair<NodeId, MessageProcessingResult>>& peer_activity)
117117
EXCLUSIVE_LOCKS_REQUIRED(!cs_nonLocked, !cs_pendingLocks, !cs_pendingRetry);
118118
MessageProcessingResult ProcessInstantSendLock(NodeId from, const uint256& hash,

src/instantsend/signing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class InstantSendSigner final : public llmq::CRecoveredSigsListener
6666
*/
6767
Uint256HashMap<InstantSendLock> creatingInstantSendLocks GUARDED_BY(cs_creating);
6868
// maps from txid to the in-progress islock
69-
std::unordered_map<uint256, InstantSendLock*, StaticSaltedHasher> txToCreatingInstantSendLocks GUARDED_BY(cs_creating);
69+
Uint256HashMap<InstantSendLock*> txToCreatingInstantSendLocks GUARDED_BY(cs_creating);
7070

7171
public:
7272
explicit InstantSendSigner(CChainState& chainstate, llmq::CChainLocksHandler& clhandler,

src/llmq/quorums.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,14 @@ class CQuorumManager
250250
mutable Mutex cs_map_quorums;
251251
mutable std::map<Consensus::LLMQType, Uint256LruHashMap<CQuorumPtr>> mapQuorumsCache GUARDED_BY(cs_map_quorums);
252252
mutable Mutex cs_scan_quorums;
253-
mutable std::map<Consensus::LLMQType, unordered_lru_cache<uint256, std::vector<CQuorumCPtr>, StaticSaltedHasher>> scanQuorumsCache GUARDED_BY(cs_scan_quorums);
253+
mutable std::map<Consensus::LLMQType, Uint256LruHashMap<std::vector<CQuorumCPtr>>> scanQuorumsCache GUARDED_BY(cs_scan_quorums);
254254
mutable Mutex cs_cleanup;
255255
mutable std::map<Consensus::LLMQType, Uint256LruHashMap<uint256>> cleanupQuorumsCache GUARDED_BY(cs_cleanup);
256256

257257
mutable Mutex cs_quorumBaseBlockIndexCache;
258258
// On mainnet, we have around 62 quorums active at any point; let's cache a little more than double that to be safe.
259-
mutable unordered_lru_cache<uint256 /*quorum_hash*/, const CBlockIndex* /*pindex*/, StaticSaltedHasher, 128 /*max_size*/> quorumBaseBlockIndexCache;
259+
// it maps `quorum_hash` to `pindex`
260+
mutable Uint256LruHashMap<const CBlockIndex*, 128 /*max_size*/> quorumBaseBlockIndexCache;
260261

261262
mutable ctpl::thread_pool workerPool;
262263
mutable CThreadInterrupt quorumThreadInterrupt;

src/llmq/signing.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ class CRecoveredSigsDb
115115

116116
mutable Mutex cs_cache;
117117
mutable unordered_lru_cache<std::pair<Consensus::LLMQType, uint256>, bool, StaticSaltedHasher, 30000> hasSigForIdCache GUARDED_BY(cs_cache);
118-
mutable unordered_lru_cache<uint256, bool, StaticSaltedHasher, 30000> hasSigForSessionCache GUARDED_BY(cs_cache);
119-
mutable unordered_lru_cache<uint256, bool, StaticSaltedHasher, 30000> hasSigForHashCache GUARDED_BY(cs_cache);
118+
mutable Uint256LruHashMap<bool, 30000> hasSigForSessionCache GUARDED_BY(cs_cache);
119+
mutable Uint256LruHashMap<bool, 30000> hasSigForHashCache GUARDED_BY(cs_cache);
120120

121121
public:
122122
explicit CRecoveredSigsDb(bool fMemory, bool fWipe);
@@ -165,7 +165,7 @@ class CSigningManager
165165
mutable Mutex cs_pending;
166166
// Incoming and not verified yet
167167
std::unordered_map<NodeId, std::list<std::shared_ptr<const CRecoveredSig>>> pendingRecoveredSigs GUARDED_BY(cs_pending);
168-
std::unordered_map<uint256, std::shared_ptr<const CRecoveredSig>, StaticSaltedHasher> pendingReconstructedRecoveredSigs GUARDED_BY(cs_pending);
168+
Uint256HashMap<std::shared_ptr<const CRecoveredSig>> pendingReconstructedRecoveredSigs GUARDED_BY(cs_pending);
169169

170170
FastRandomContext rnd GUARDED_BY(cs_pending);
171171

src/llmq/signing_shares.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ void CSigSharesManager::CollectSigSharesToSendConcentrated(std::unordered_map<No
10081008
{
10091009
AssertLockHeld(cs);
10101010

1011-
std::unordered_map<uint256, CNode*, StaticSaltedHasher> proTxToNode;
1011+
Uint256HashMap<CNode*> proTxToNode;
10121012
for (const auto& pnode : vNodes) {
10131013
auto verifiedProRegTxHash = pnode->GetVerifiedProRegTxHash();
10141014
if (verifiedProRegTxHash.IsNull()) {

src/llmq/signing_shares.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ template<typename T>
157157
class SigShareMap
158158
{
159159
private:
160-
std::unordered_map<uint256, std::unordered_map<uint16_t, T>, StaticSaltedHasher> internalMap;
160+
Uint256HashMap<std::unordered_map<uint16_t, T>> internalMap;
161161

162162
public:
163163
bool Add(const SigShareKey& k, const T& v)
@@ -384,7 +384,7 @@ class CSigSharesManager : public CRecoveredSigsListener
384384
Uint256HashMap<CSignedSession> signedSessions GUARDED_BY(cs);
385385

386386
// stores time of last receivedSigShare. Used to detect timeouts
387-
std::unordered_map<uint256, int64_t, StaticSaltedHasher> timeSeenForSessions GUARDED_BY(cs);
387+
Uint256HashMap<int64_t> timeSeenForSessions GUARDED_BY(cs);
388388

389389
std::unordered_map<NodeId, CSigSharesNodeState> nodeStates GUARDED_BY(cs);
390390
SigShareMap<std::pair<NodeId, int64_t>> sigSharesRequested GUARDED_BY(cs);

src/llmq/utils.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ std::vector<CDeterministicMNCPtr> GetAllQuorumMembers(Consensus::LLMQType llmqTy
204204
bool reset_cache)
205205
{
206206
static RecursiveMutex cs_members;
207-
static std::map<Consensus::LLMQType, unordered_lru_cache<uint256, std::vector<CDeterministicMNCPtr>, StaticSaltedHasher>> mapQuorumMembers GUARDED_BY(cs_members);
207+
static std::map<Consensus::LLMQType, Uint256LruHashMap<std::vector<CDeterministicMNCPtr>>> mapQuorumMembers GUARDED_BY(cs_members);
208208
static RecursiveMutex cs_indexed_members;
209209
static std::map<Consensus::LLMQType, unordered_lru_cache<std::pair<uint256, int>, std::vector<CDeterministicMNCPtr>, StaticSaltedHasher>> mapIndexedQuorumMembers GUARDED_BY(cs_indexed_members);
210210
if (!IsQuorumTypeEnabled(llmqType, pQuorumBaseBlockIndex->pprev)) {
@@ -969,13 +969,13 @@ void InitQuorumsCache(CacheType& cache, bool limit_by_connections)
969969
}
970970
}
971971
template void InitQuorumsCache<std::map<Consensus::LLMQType, Uint256LruHashMap<bool>>>(std::map<Consensus::LLMQType, Uint256LruHashMap<bool>>& cache, bool limit_by_connections);
972-
template void InitQuorumsCache<std::map<Consensus::LLMQType, unordered_lru_cache<uint256, std::vector<CQuorumCPtr>, StaticSaltedHasher>>>(std::map<Consensus::LLMQType, unordered_lru_cache<uint256, std::vector<CQuorumCPtr>, StaticSaltedHasher>>& cache, bool limit_by_connections);
973-
template void InitQuorumsCache<std::map<Consensus::LLMQType, unordered_lru_cache<uint256, std::shared_ptr<llmq::CQuorum>, StaticSaltedHasher, 0ul, 0ul>, std::less<Consensus::LLMQType>, std::allocator<std::pair<Consensus::LLMQType const, unordered_lru_cache<uint256, std::shared_ptr<llmq::CQuorum>, StaticSaltedHasher, 0ul, 0ul>>>>>(std::map<Consensus::LLMQType, unordered_lru_cache<uint256, std::shared_ptr<llmq::CQuorum>, StaticSaltedHasher, 0ul, 0ul>, std::less<Consensus::LLMQType>, std::allocator<std::pair<Consensus::LLMQType const, unordered_lru_cache<uint256, std::shared_ptr<llmq::CQuorum>, StaticSaltedHasher, 0ul, 0ul>>>>&cache, bool limit_by_connections);
972+
template void InitQuorumsCache<std::map<Consensus::LLMQType, Uint256LruHashMap<std::vector<CQuorumCPtr>>>>(std::map<Consensus::LLMQType, Uint256LruHashMap<std::vector<CQuorumCPtr>>>& cache, bool limit_by_connections);
973+
template void InitQuorumsCache<std::map<Consensus::LLMQType, Uint256LruHashMap<std::shared_ptr<llmq::CQuorum>>, std::less<Consensus::LLMQType>, std::allocator<std::pair<Consensus::LLMQType const, Uint256LruHashMap<std::shared_ptr<llmq::CQuorum>>>>>>(std::map<Consensus::LLMQType, Uint256LruHashMap<std::shared_ptr<llmq::CQuorum>>, std::less<Consensus::LLMQType>, std::allocator<std::pair<Consensus::LLMQType const, Uint256LruHashMap<std::shared_ptr<llmq::CQuorum>>>>>&cache, bool limit_by_connections);
974974
template void InitQuorumsCache<std::map<Consensus::LLMQType, Uint256LruHashMap<int>>>(std::map<Consensus::LLMQType, Uint256LruHashMap<int>>& cache, bool limit_by_connections);
975975
template void InitQuorumsCache<std::map<Consensus::LLMQType, Uint256LruHashMap<uint256>>>(std::map<Consensus::LLMQType, Uint256LruHashMap<uint256>>& cache, bool limit_by_connections);
976976
template void
977-
InitQuorumsCache<std::map<Consensus::LLMQType, unordered_lru_cache<uint256, std::pair<uint256, int>, StaticSaltedHasher>>>(
978-
std::map<Consensus::LLMQType, unordered_lru_cache<uint256, std::pair<uint256, int>, StaticSaltedHasher>>& cache,
977+
InitQuorumsCache<std::map<Consensus::LLMQType, Uint256LruHashMap<std::pair<uint256, int>>>>(
978+
std::map<Consensus::LLMQType, Uint256LruHashMap<std::pair<uint256, int>>>& cache,
979979
bool limit_by_connections);
980980
} // namespace utils
981981
} // namespace llmq

0 commit comments

Comments
 (0)