@@ -282,8 +282,9 @@ class ChainImpl : public Chain
282
282
}
283
283
bool hasDescendantsInMempool (const uint256& txid) override
284
284
{
285
- LOCK (::mempool.cs );
286
- auto it = ::mempool.GetIter (txid);
285
+ if (!m_node.mempool ) return false ;
286
+ LOCK (m_node.mempool ->cs );
287
+ auto it = m_node.mempool ->GetIter (txid);
287
288
return it && (*it)->GetCountWithDescendants () > 1 ;
288
289
}
289
290
bool broadcastTransaction (const CTransactionRef& tx,
@@ -299,7 +300,9 @@ class ChainImpl : public Chain
299
300
}
300
301
void getTransactionAncestry (const uint256& txid, size_t & ancestors, size_t & descendants) override
301
302
{
302
- ::mempool.GetTransactionAncestry (txid, ancestors, descendants);
303
+ ancestors = descendants = 0 ;
304
+ if (!m_node.mempool ) return ;
305
+ m_node.mempool ->GetTransactionAncestry (txid, ancestors, descendants);
303
306
}
304
307
void getPackageLimits (unsigned int & limit_ancestor_count, unsigned int & limit_descendant_count) override
305
308
{
@@ -308,6 +311,7 @@ class ChainImpl : public Chain
308
311
}
309
312
bool checkChainLimits (const CTransactionRef& tx) override
310
313
{
314
+ if (!m_node.mempool ) return true ;
311
315
LockPoints lp;
312
316
CTxMemPoolEntry entry (tx, 0 , 0 , 0 , false , 0 , lp);
313
317
CTxMemPool::setEntries ancestors;
@@ -316,8 +320,9 @@ class ChainImpl : public Chain
316
320
auto limit_descendant_count = gArgs .GetArg (" -limitdescendantcount" , DEFAULT_DESCENDANT_LIMIT);
317
321
auto limit_descendant_size = gArgs .GetArg (" -limitdescendantsize" , DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 ;
318
322
std::string unused_error_string;
319
- LOCK (::mempool.cs );
320
- return ::mempool.CalculateMemPoolAncestors (entry, ancestors, limit_ancestor_count, limit_ancestor_size,
323
+ LOCK (m_node.mempool ->cs );
324
+ return m_node.mempool ->CalculateMemPoolAncestors (
325
+ entry, ancestors, limit_ancestor_count, limit_ancestor_size,
321
326
limit_descendant_count, limit_descendant_size, unused_error_string);
322
327
}
323
328
CFeeRate estimateSmartFee (int num_blocks, bool conservative, FeeCalculation* calc) override
@@ -330,7 +335,8 @@ class ChainImpl : public Chain
330
335
}
331
336
CFeeRate mempoolMinFee () override
332
337
{
333
- return ::mempool.GetMinFee (gArgs .GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 );
338
+ if (!m_node.mempool ) return {};
339
+ return m_node.mempool ->GetMinFee (gArgs .GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 );
334
340
}
335
341
CFeeRate relayMinFee () override { return ::minRelayTxFee; }
336
342
CFeeRate relayIncrementalFee () override { return ::incrementalRelayFee; }
@@ -396,8 +402,9 @@ class ChainImpl : public Chain
396
402
}
397
403
void requestMempoolTransactions (Notifications& notifications) override
398
404
{
399
- LOCK2 (::cs_main, ::mempool.cs );
400
- for (const CTxMemPoolEntry& entry : ::mempool.mapTx ) {
405
+ if (!m_node.mempool ) return ;
406
+ LOCK2 (::cs_main, m_node.mempool ->cs );
407
+ for (const CTxMemPoolEntry& entry : m_node.mempool ->mapTx ) {
401
408
notifications.transactionAddedToMempool (entry.GetSharedTx ());
402
409
}
403
410
}
0 commit comments