Skip to content

Commit a432a95

Browse files
committed
fix: check if queueman is initialized before accessing it
CCoinJoinClientQueueManager is conditionally initialized, we will be deref'ing a nullptr if relay_txes is false.
1 parent 0444e59 commit a432a95

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/net_processing.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2276,11 +2276,11 @@ bool PeerManagerImpl::AlreadyHave(const CInv& inv)
22762276
case MSG_ISDLOCK:
22772277
return m_llmq_ctx->isman->AlreadyHave(inv);
22782278
case MSG_DSQ:
2279+
return
22792280
#ifdef ENABLE_WALLET
2280-
return m_cj_ctx->queueman->HasQueue(inv.hash) || (m_active_ctx && m_active_ctx->cj_server->HasQueue(inv.hash));
2281-
#else
2282-
return m_active_ctx && m_active_ctx->cj_server->HasQueue(inv.hash);
2283-
#endif
2281+
(m_cj_ctx->queueman && m_cj_ctx->queueman->HasQueue(inv.hash)) ||
2282+
#endif // ENABLE_WALLET
2283+
(m_active_ctx && m_active_ctx->cj_server->HasQueue(inv.hash));
22842284
}
22852285

22862286

@@ -2885,7 +2885,7 @@ void PeerManagerImpl::ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic
28852885
if (!push && inv.type == MSG_DSQ) {
28862886
auto opt_dsq = m_active_ctx ? m_active_ctx->cj_server->GetQueueFromHash(inv.hash) : std::nullopt;
28872887
#ifdef ENABLE_WALLET
2888-
if (!opt_dsq.has_value()) {
2888+
if (m_cj_ctx->queueman && !opt_dsq.has_value()) {
28892889
opt_dsq = m_cj_ctx->queueman->GetQueueFromHash(inv.hash);
28902890
}
28912891
#endif
@@ -5273,7 +5273,9 @@ void PeerManagerImpl::ProcessMessage(
52735273
{
52745274
//probably one the extensions
52755275
#ifdef ENABLE_WALLET
5276-
PostProcessMessage(m_cj_ctx->queueman->ProcessMessage(pfrom.GetId(), m_connman, *this, msg_type, vRecv), pfrom.GetId());
5276+
if (m_cj_ctx->queueman) {
5277+
PostProcessMessage(m_cj_ctx->queueman->ProcessMessage(pfrom.GetId(), m_connman, *this, msg_type, vRecv), pfrom.GetId());
5278+
}
52775279
m_cj_ctx->walletman->ForEachCJClientMan([this, &pfrom, &msg_type, &vRecv](std::unique_ptr<CCoinJoinClientManager>& clientman) {
52785280
clientman->ProcessMessage(pfrom, m_chainman.ActiveChainstate(), m_connman, m_mempool, msg_type, vRecv);
52795281
});

src/rpc/coinjoin.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,9 @@ static RPCHelpMan getcoinjoininfo()
474474
#ifdef ENABLE_WALLET
475475
CCoinJoinClientOptions::GetJsonInfo(obj);
476476

477-
obj.pushKV("queue_size", node.cj_ctx->queueman->GetQueueSize());
477+
if (node.cj_ctx->queueman) {
478+
obj.pushKV("queue_size", node.cj_ctx->queueman->GetQueueSize());
479+
}
478480

479481
const std::shared_ptr<const CWallet> wallet = GetWalletForJSONRPCRequest(request);
480482
if (!wallet) {

0 commit comments

Comments
 (0)