@@ -315,9 +315,7 @@ static void entryToJSON(const CTxMemPool& pool, UniValue& info, const CTxMemPool
315
315
info.pushKV (" depends" , depends);
316
316
317
317
UniValue spent (UniValue::VARR);
318
- const CTxMemPool::txiter& it = pool.mapTx .find (tx.GetHash ());
319
- const CTxMemPoolEntry::Children& children = it->GetMemPoolChildrenConst ();
320
- for (const CTxMemPoolEntry& child : children) {
318
+ for (const CTxMemPoolEntry& child : e.GetMemPoolChildrenConst ()) {
321
319
spent.push_back (child.GetTx ().GetHash ().ToString ());
322
320
}
323
321
@@ -459,12 +457,12 @@ static RPCHelpMan getmempoolancestors()
459
457
const CTxMemPool& mempool = EnsureAnyMemPool (request.context );
460
458
LOCK (mempool.cs );
461
459
462
- CTxMemPool::txiter it = mempool.mapTx . find ( hash);
463
- if (it == mempool. mapTx . end () ) {
460
+ const auto entry{ mempool.GetEntry ( Txid::FromUint256 ( hash))} ;
461
+ if (entry == nullptr ) {
464
462
throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Transaction not in mempool" );
465
463
}
466
464
467
- auto ancestors{mempool.AssumeCalculateMemPoolAncestors (self.m_name , *it , CTxMemPool::Limits::NoLimits (), /* fSearchForParents=*/ false )};
465
+ auto ancestors{mempool.AssumeCalculateMemPoolAncestors (self.m_name , *entry , CTxMemPool::Limits::NoLimits (), /* fSearchForParents=*/ false )};
468
466
469
467
if (!fVerbose ) {
470
468
UniValue o (UniValue::VARR);
@@ -520,15 +518,15 @@ static RPCHelpMan getmempooldescendants()
520
518
const CTxMemPool& mempool = EnsureAnyMemPool (request.context );
521
519
LOCK (mempool.cs );
522
520
523
- CTxMemPool::txiter it = mempool.mapTx . find (hash);
524
- if (it == mempool. mapTx . end () ) {
521
+ const auto it{ mempool.GetIter (hash)} ;
522
+ if (!it ) {
525
523
throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Transaction not in mempool" );
526
524
}
527
525
528
526
CTxMemPool::setEntries setDescendants;
529
- mempool.CalculateDescendants (it, setDescendants);
527
+ mempool.CalculateDescendants (* it, setDescendants);
530
528
// CTxMemPool::CalculateDescendants will include the given tx
531
- setDescendants.erase (it);
529
+ setDescendants.erase (* it);
532
530
533
531
if (!fVerbose ) {
534
532
UniValue o (UniValue::VARR);
@@ -572,14 +570,13 @@ static RPCHelpMan getmempoolentry()
572
570
const CTxMemPool& mempool = EnsureAnyMemPool (request.context );
573
571
LOCK (mempool.cs );
574
572
575
- CTxMemPool::txiter it = mempool.mapTx . find ( hash);
576
- if (it == mempool. mapTx . end () ) {
573
+ const auto entry{ mempool.GetEntry ( Txid::FromUint256 ( hash))} ;
574
+ if (entry == nullptr ) {
577
575
throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Transaction not in mempool" );
578
576
}
579
577
580
- const CTxMemPoolEntry &e = *it;
581
578
UniValue info (UniValue::VOBJ);
582
- entryToJSON (mempool, info, e );
579
+ entryToJSON (mempool, info, *entry );
583
580
return info;
584
581
},
585
582
};
0 commit comments