@@ -134,7 +134,7 @@ void CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CDataStream&
134134 }
135135}
136136
137- void CCoinJoinClientManager::ProcessMessage (CNode& peer, std::string_view msg_type, CDataStream& vRecv, CConnman& connman)
137+ void CCoinJoinClientManager::ProcessMessage (const CTxMemPool& mempool, CNode& peer, std::string_view msg_type, CDataStream& vRecv, CConnman& connman)
138138{
139139 if (fMasternodeMode ) return ;
140140 if (!CCoinJoinClientOptions::IsEnabled ()) return ;
@@ -153,12 +153,12 @@ void CCoinJoinClientManager::ProcessMessage(CNode& peer, std::string_view msg_ty
153153 AssertLockNotHeld (cs_deqsessions);
154154 LOCK (cs_deqsessions);
155155 for (auto & session : deqSessions) {
156- session.ProcessMessage (peer, msg_type, vRecv, connman);
156+ session.ProcessMessage (mempool, peer, msg_type, vRecv, connman);
157157 }
158158 }
159159}
160160
161- void CCoinJoinClientSession::ProcessMessage (CNode& peer, std::string_view msg_type, CDataStream& vRecv, CConnman& connman)
161+ void CCoinJoinClientSession::ProcessMessage (const CTxMemPool& mempool, CNode& peer, std::string_view msg_type, CDataStream& vRecv, CConnman& connman)
162162{
163163 if (fMasternodeMode ) return ;
164164 if (!CCoinJoinClientOptions::IsEnabled ()) return ;
@@ -193,7 +193,7 @@ void CCoinJoinClientSession::ProcessMessage(CNode& peer, std::string_view msg_ty
193193 LogPrint (BCLog::COINJOIN, " DSFINALTX -- txNew %s" , txNew.ToString ()); /* Continued */
194194
195195 // check to see if input is spent already? (and probably not confirmed)
196- SignFinalTransaction (txNew, peer, connman);
196+ SignFinalTransaction (mempool, txNew, peer, connman);
197197
198198 } else if (msg_type == NetMsgType::DSCOMPLETE) {
199199 if (!mixingMasternode) return ;
@@ -539,7 +539,7 @@ void CCoinJoinClientSession::ProcessPoolStateUpdate(CCoinJoinStatusUpdate psssup
539539// check it to make sure it's what we want, then sign it if we agree.
540540// If we refuse to sign, it's possible we'll be charged collateral
541541//
542- bool CCoinJoinClientSession::SignFinalTransaction (const CTransaction& finalTransactionNew, CNode& peer, CConnman& connman)
542+ bool CCoinJoinClientSession::SignFinalTransaction (const CTxMemPool& mempool, const CTransaction& finalTransactionNew, CNode& peer, CConnman& connman)
543543{
544544 if (!CCoinJoinClientOptions::IsEnabled ()) return false ;
545545
@@ -568,7 +568,7 @@ bool CCoinJoinClientSession::SignFinalTransaction(const CTransaction& finalTrans
568568
569569 // Make sure all inputs/outputs are valid
570570 PoolMessage nMessageID{MSG_NOERR};
571- if (!IsValidInOuts (finalMutableTransaction.vin , finalMutableTransaction.vout , nMessageID, nullptr )) {
571+ if (!IsValidInOuts (mempool, finalMutableTransaction.vin , finalMutableTransaction.vout , nMessageID, nullptr )) {
572572 LogPrint (BCLog::COINJOIN, " CCoinJoinClientSession::%s -- ERROR! IsValidInOuts() failed: %s\n " , __func__, CCoinJoin::GetMessageByID (nMessageID).translated );
573573 UnlockCoins ();
574574 keyHolderStorage.ReturnAll ();
@@ -756,7 +756,7 @@ bool CCoinJoinClientManager::CheckAutomaticBackup()
756756//
757757// Passively run mixing in the background to mix funds based on the given configuration.
758758//
759- bool CCoinJoinClientSession::DoAutomaticDenominating (CConnman& connman, bool fDryRun )
759+ bool CCoinJoinClientSession::DoAutomaticDenominating (CTxMemPool& mempool, CConnman& connman, bool fDryRun )
760760{
761761 if (fMasternodeMode ) return false ; // no client-side mixing on masternodes
762762 if (nState != POOL_STATE_IDLE) return false ;
@@ -909,7 +909,7 @@ bool CCoinJoinClientSession::DoAutomaticDenominating(CConnman& connman, bool fDr
909909 return false ;
910910 }
911911 } else {
912- if (!CCoinJoin::IsCollateralValid (CTransaction (txMyCollateral))) {
912+ if (!CCoinJoin::IsCollateralValid (mempool, CTransaction (txMyCollateral))) {
913913 LogPrint (BCLog::COINJOIN, " CCoinJoinClientSession::DoAutomaticDenominating -- invalid collateral, recreating...\n " );
914914 if (!CreateCollateralTransaction (txMyCollateral, strReason)) {
915915 LogPrint (BCLog::COINJOIN, " CCoinJoinClientSession::DoAutomaticDenominating -- create collateral error: %s\n " , strReason);
@@ -936,7 +936,7 @@ bool CCoinJoinClientSession::DoAutomaticDenominating(CConnman& connman, bool fDr
936936 return false ;
937937}
938938
939- bool CCoinJoinClientManager::DoAutomaticDenominating (CConnman& connman, bool fDryRun )
939+ bool CCoinJoinClientManager::DoAutomaticDenominating (CTxMemPool& mempool, CConnman& connman, bool fDryRun )
940940{
941941 if (fMasternodeMode ) return false ; // no client-side mixing on masternodes
942942 if (!CCoinJoinClientOptions::IsEnabled () || !IsMixing ()) return false ;
@@ -978,7 +978,7 @@ bool CCoinJoinClientManager::DoAutomaticDenominating(CConnman& connman, bool fDr
978978 return false ;
979979 }
980980
981- fResult &= session.DoAutomaticDenominating (connman, fDryRun );
981+ fResult &= session.DoAutomaticDenominating (mempool, connman, fDryRun );
982982 }
983983
984984 return fResult ;
@@ -1815,7 +1815,7 @@ void CCoinJoinClientQueueManager::DoMaintenance()
18151815 CheckQueue ();
18161816}
18171817
1818- void CCoinJoinClientManager::DoMaintenance (CConnman& connman)
1818+ void CCoinJoinClientManager::DoMaintenance (CTxMemPool& mempool, CConnman& connman)
18191819{
18201820 if (!CCoinJoinClientOptions::IsEnabled ()) return ;
18211821 if (m_mn_sync == nullptr ) return ;
@@ -1830,7 +1830,7 @@ void CCoinJoinClientManager::DoMaintenance(CConnman& connman)
18301830 CheckTimeout ();
18311831 ProcessPendingDsaRequest (connman);
18321832 if (nDoAutoNextRun == nTick) {
1833- DoAutomaticDenominating (connman);
1833+ DoAutomaticDenominating (mempool, connman);
18341834 nDoAutoNextRun = nTick + COINJOIN_AUTO_TIMEOUT_MIN + GetRandInt (COINJOIN_AUTO_TIMEOUT_MAX - COINJOIN_AUTO_TIMEOUT_MIN);
18351835 }
18361836}
@@ -1867,14 +1867,14 @@ void CCoinJoinClientManager::GetJsonInfo(UniValue& obj) const
18671867 obj.pushKV (" sessions" , arrSessions);
18681868}
18691869
1870- void DoCoinJoinMaintenance (CConnman& connman)
1870+ void DoCoinJoinMaintenance (CTxMemPool& mempool, CConnman& connman)
18711871{
18721872 if (coinJoinClientQueueManager != nullptr ) {
18731873 coinJoinClientQueueManager->DoMaintenance ();
18741874 }
18751875
18761876 for (const auto & pair : coinJoinClientManagers) {
1877- pair.second ->DoMaintenance (connman);
1877+ pair.second ->DoMaintenance (mempool, connman);
18781878 }
18791879}
18801880
0 commit comments