@@ -528,7 +528,7 @@ static UniValue getrawmempool(const JSONRPCRequest& request)
528528 if (!request.params [0 ].isNull ())
529529 fVerbose = request.params [0 ].get_bool ();
530530
531- return MempoolToJSON (::mempool , fVerbose );
531+ return MempoolToJSON (EnsureMemPool () , fVerbose );
532532}
533533
534534static UniValue getmempoolancestors (const JSONRPCRequest& request)
@@ -566,6 +566,7 @@ static UniValue getmempoolancestors(const JSONRPCRequest& request)
566566
567567 uint256 hash = ParseHashV (request.params [0 ], " parameter 1" );
568568
569+ const CTxMemPool& mempool = EnsureMemPool ();
569570 LOCK (mempool.cs );
570571
571572 CTxMemPool::txiter it = mempool.mapTx .find (hash);
@@ -591,7 +592,7 @@ static UniValue getmempoolancestors(const JSONRPCRequest& request)
591592 const CTxMemPoolEntry &e = *ancestorIt;
592593 const uint256& _hash = e.GetTx ().GetHash ();
593594 UniValue info (UniValue::VOBJ);
594- entryToJSON (:: mempool, info, e);
595+ entryToJSON (mempool, info, e);
595596 o.pushKV (_hash.ToString (), info);
596597 }
597598 return o;
@@ -633,6 +634,7 @@ static UniValue getmempooldescendants(const JSONRPCRequest& request)
633634
634635 uint256 hash = ParseHashV (request.params [0 ], " parameter 1" );
635636
637+ const CTxMemPool& mempool = EnsureMemPool ();
636638 LOCK (mempool.cs );
637639
638640 CTxMemPool::txiter it = mempool.mapTx .find (hash);
@@ -658,7 +660,7 @@ static UniValue getmempooldescendants(const JSONRPCRequest& request)
658660 const CTxMemPoolEntry &e = *descendantIt;
659661 const uint256& _hash = e.GetTx ().GetHash ();
660662 UniValue info (UniValue::VOBJ);
661- entryToJSON (:: mempool, info, e);
663+ entryToJSON (mempool, info, e);
662664 o.pushKV (_hash.ToString (), info);
663665 }
664666 return o;
@@ -685,6 +687,7 @@ static UniValue getmempoolentry(const JSONRPCRequest& request)
685687
686688 uint256 hash = ParseHashV (request.params [0 ], " parameter 1" );
687689
690+ const CTxMemPool& mempool = EnsureMemPool ();
688691 LOCK (mempool.cs );
689692
690693 CTxMemPool::txiter it = mempool.mapTx .find (hash);
@@ -694,7 +697,7 @@ static UniValue getmempoolentry(const JSONRPCRequest& request)
694697
695698 const CTxMemPoolEntry &e = *it;
696699 UniValue info (UniValue::VOBJ);
697- entryToJSON (:: mempool, info, e);
700+ entryToJSON (mempool, info, e);
698701 return info;
699702}
700703
@@ -1070,6 +1073,7 @@ UniValue gettxout(const JSONRPCRequest& request)
10701073 CCoinsViewCache* coins_view = &::ChainstateActive ().CoinsTip ();
10711074
10721075 if (fMempool ) {
1076+ const CTxMemPool& mempool = EnsureMemPool ();
10731077 LOCK (mempool.cs );
10741078 CCoinsViewMemPool view (coins_view, mempool);
10751079 if (!view.GetCoin (out, coin) || mempool.isSpent (out)) {
@@ -1448,7 +1452,7 @@ static UniValue getmempoolinfo(const JSONRPCRequest& request)
14481452 },
14491453 }.Check (request);
14501454
1451- return MempoolInfoToJSON (::mempool );
1455+ return MempoolInfoToJSON (EnsureMemPool () );
14521456}
14531457
14541458static UniValue preciousblock (const JSONRPCRequest& request)
@@ -1964,11 +1968,13 @@ static UniValue savemempool(const JSONRPCRequest& request)
19641968 },
19651969 }.Check (request);
19661970
1967- if (!::mempool.IsLoaded ()) {
1971+ const CTxMemPool& mempool = EnsureMemPool ();
1972+
1973+ if (!mempool.IsLoaded ()) {
19681974 throw JSONRPCError (RPC_MISC_ERROR, " The mempool was not loaded yet" );
19691975 }
19701976
1971- if (!DumpMempool (:: mempool)) {
1977+ if (!DumpMempool (mempool)) {
19721978 throw JSONRPCError (RPC_MISC_ERROR, " Unable to dump mempool to disk" );
19731979 }
19741980
0 commit comments