Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/coinjoin/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,15 @@ void CCoinJoinServer::ChargeFees() const
*/
void CCoinJoinServer::ChargeRandomFees() const
{
for (const auto& txCollateral : vecSessionCollaterals) {
AssertLockNotHeld(cs_coinjoin);

std::vector<CTransactionRef> session_collaterals;
{
LOCK(cs_coinjoin);
session_collaterals = vecSessionCollaterals;
}

for (const auto& txCollateral : session_collaterals) {
if (GetRand<int>(/*nMax=*/100) > 10) return;
LogPrint(BCLog::COINJOIN, /* Continued */
"CCoinJoinServer::ChargeRandomFees -- charging random fees, txCollateral=%s", txCollateral->ToString());
Expand Down
2 changes: 1 addition & 1 deletion src/coinjoin/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CCoinJoinServer : public CCoinJoinBaseSession, public NetHandler
/// Charge fees to bad actors (Charge clients a fee if they're abusive)
void ChargeFees() const EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);
/// Rarely charge fees to pay miners
void ChargeRandomFees() const;
void ChargeRandomFees() const EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);
/// Consume collateral in cases when peer misbehaved
void ConsumeCollateral(const CTransactionRef& txref) const;

Expand Down
Loading