Skip to content

Commit

Permalink
Satisfy linter: added circular dependency, missing const, fixed usage…
Browse files Browse the repository at this point in the history
… of macros GUARDED_BY
  • Loading branch information
knst committed Nov 29, 2022
1 parent d2e9e20 commit 31b9736
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/evo/assetlocktx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ maybe_error CAssetUnlockPayload::VerifySig(const uint256& msgHash, const CBlockI
// TODO: update it after choosing proper consensus.llmqTypeAssetLocks (see comment there)
const int count = 2;
auto quorums = llmq::quorumManager->ScanQuorums(llmqType, pindexTip, count > -1 ? count : llmq_params.signingActiveQuorumCount);
bool isActive = std::any_of(quorums.begin(), quorums.end(), [&](auto &q) { return q->qc->quorumHash == quorumHash; });
bool isActive = std::any_of(quorums.begin(), quorums.end(), [&](const auto &q) { return q->qc->quorumHash == quorumHash; });

if (!isActive) {
return {ValidationInvalidReason::CONSENSUS, "bad-assetunlock-not-active-quorum"};
Expand Down
5 changes: 0 additions & 5 deletions src/evo/creditpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ static bool getAmountToUnlock(const CTransaction& tx, CAmount& toUnlock, int64_t
return true;
}

namespace {
CCriticalSection cs_cache;

} // anonymous namespace

std::optional<CreditPoolCb> CCreditPoolManager::getFromCache(const uint256& block_hash, int height) {
LOCK(cs_cache);
CreditPoolCb pool{0, 0, {}};
Expand Down
3 changes: 2 additions & 1 deletion src/evo/creditpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ class CCreditPoolManager
{
private:
static constexpr size_t CreditPoolCacheSize = 1000;
unordered_lru_cache<uint256, CreditPoolCb, StaticSaltedHasher> creditPoolCache{CreditPoolCacheSize} GUARDED_BY(cs_cache);
CCriticalSection cs_cache;
unordered_lru_cache<uint256, CreditPoolCb, StaticSaltedHasher> creditPoolCache GUARDED_BY(cs_cache) {CreditPoolCacheSize};

CEvoDB& evoDb;

Expand Down
2 changes: 2 additions & 0 deletions test/lint/lint-circular-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
"evo/specialtxman -> validation -> evo/specialtxman"
"consensus/tx_verify -> evo/assetlocktx -> validation -> consensus/tx_verify"
"consensus/tx_verify -> evo/assetlocktx -> llmq/quorums -> net_processing -> txmempool -> consensus/tx_verify"
"evo/assetlocktx -> evo/creditpool -> evo/assetlocktx"
"evo/assetlocktx -> llmq/quorums -> net_processing -> txmempool -> evo/assetlocktx"

"evo/simplifiedmns -> llmq/blockprocessor -> net_processing -> llmq/snapshot -> evo/simplifiedmns"
"llmq/blockprocessor -> net_processing -> llmq/context -> llmq/blockprocessor"
Expand Down

0 comments on commit 31b9736

Please sign in to comment.