Skip to content

Commit 8e12987

Browse files
authored
Partially revert 1922 (#2108)
Turned out we actually need mixing collaterals charged as fees in our mempool for them to be relayed.
1 parent 8c2d16f commit 8e12987

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/privatesend-server.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,15 @@ void CPrivateSendServer::ChargeFees(CConnman& connman)
448448
LogPrintf("CPrivateSendServer::ChargeFees -- found uncooperative node (didn't %s transaction), charging fees: %s\n",
449449
(nState == POOL_STATE_SIGNING) ? "sign" : "send", vecOffendersCollaterals[0]->ToString());
450450

451-
connman.RelayTransaction(*vecOffendersCollaterals[0]);
451+
LOCK(cs_main);
452+
453+
CValidationState state;
454+
if(!AcceptToMemoryPool(mempool, state, vecOffendersCollaterals[0], false, NULL, NULL, false, maxTxFee)) {
455+
// should never really happen
456+
LogPrintf("CPrivateSendServer::ChargeFees -- ERROR: AcceptToMemoryPool failed!\n");
457+
} else {
458+
connman.RelayTransaction(*vecOffendersCollaterals[0]);
459+
}
452460
}
453461
}
454462

@@ -468,10 +476,19 @@ void CPrivateSendServer::ChargeRandomFees(CConnman& connman)
468476
{
469477
if(!fMasternodeMode) return;
470478

479+
LOCK(cs_main);
480+
471481
for (const auto& txCollateral : vecSessionCollaterals) {
472482
if(GetRandInt(100) > 10) return;
473483
LogPrintf("CPrivateSendServer::ChargeRandomFees -- charging random fees, txCollateral=%s", txCollateral->ToString());
474-
connman.RelayTransaction(*txCollateral);
484+
485+
CValidationState state;
486+
if(!AcceptToMemoryPool(mempool, state, txCollateral, false, NULL, NULL, false, maxTxFee)) {
487+
// should never really happen
488+
LogPrintf("CPrivateSendServer::ChargeRandomFees -- ERROR: AcceptToMemoryPool failed!\n");
489+
} else {
490+
connman.RelayTransaction(*txCollateral);
491+
}
475492
}
476493
}
477494

0 commit comments

Comments
 (0)