@@ -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