Skip to content

Commit eb3be09

Browse files
committed
refactor: code style/log text adjustments
1 parent f50d09a commit eb3be09

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/coinjoin/client.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -966,15 +966,14 @@ bool CCoinJoinClientManager::DoAutomaticDenominating(ChainstateManager& chainman
966966
// If we've used 90% of the Masternode list then drop the oldest first ~30%
967967
int nThreshold_high = nMnCountEnabled * 0.9;
968968
int nThreshold_low = nThreshold_high * 0.7;
969-
size_t nUsedMasternodes{m_mn_metaman.GetUsedMasternodesCount()};
969+
size_t used_count{m_mn_metaman.GetUsedMasternodesCount()};
970970

971-
WalletCJLogPrint(m_wallet, "Checking nUsedMasternodes: %d, threshold: %d\n", (int)nUsedMasternodes, nThreshold_high);
971+
WalletCJLogPrint(m_wallet, "Checking threshold - used: %d, threshold: %d\n", (int)used_count, nThreshold_high);
972972

973-
if ((int)nUsedMasternodes > nThreshold_high) {
974-
size_t nToRemove{nUsedMasternodes - nThreshold_low};
975-
m_mn_metaman.RemoveUsedMasternodes(nToRemove);
976-
WalletCJLogPrint(m_wallet, " new nUsedMasternodes: %d, threshold: %d\n",
977-
(int)m_mn_metaman.GetUsedMasternodesCount(), nThreshold_high);
973+
if ((int)used_count > nThreshold_high) {
974+
m_mn_metaman.RemoveUsedMasternodes(used_count - nThreshold_low);
975+
WalletCJLogPrint(m_wallet, " new used: %d, threshold: %d\n", (int)m_mn_metaman.GetUsedMasternodesCount(),
976+
nThreshold_high);
978977
}
979978

980979
bool fResult = true;

src/masternode/meta.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ void CMasternodeMetaMan::AddUsedMasternode(const uint256& proTxHash)
162162
}
163163
}
164164

165-
void CMasternodeMetaMan::RemoveUsedMasternodes(size_t nCount)
165+
void CMasternodeMetaMan::RemoveUsedMasternodes(size_t count)
166166
{
167167
LOCK(cs);
168168
size_t removed = 0;
169-
while (removed < nCount && !m_used_masternodes.empty()) {
169+
while (removed < count && !m_used_masternodes.empty()) {
170170
// Remove from both the set and the deque
171171
m_used_masternodes_set.erase(m_used_masternodes.front());
172172
m_used_masternodes.pop_front();

src/masternode/meta.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class CMasternodeMetaMan : public MasternodeMetaStore
276276

277277
// CoinJoin masternode tracking
278278
void AddUsedMasternode(const uint256& proTxHash) EXCLUSIVE_LOCKS_REQUIRED(!cs);
279-
void RemoveUsedMasternodes(size_t nCount) EXCLUSIVE_LOCKS_REQUIRED(!cs);
279+
void RemoveUsedMasternodes(size_t count) EXCLUSIVE_LOCKS_REQUIRED(!cs);
280280
size_t GetUsedMasternodesCount() const EXCLUSIVE_LOCKS_REQUIRED(!cs);
281281
bool IsUsedMasternode(const uint256& proTxHash) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
282282
};

0 commit comments

Comments
 (0)