@@ -528,7 +528,7 @@ static UniValue getrawmempool(const JSONRPCRequest& request)
528
528
if (!request.params [0 ].isNull ())
529
529
fVerbose = request.params [0 ].get_bool ();
530
530
531
- return MempoolToJSON (::mempool , fVerbose );
531
+ return MempoolToJSON (EnsureMemPool () , fVerbose );
532
532
}
533
533
534
534
static UniValue getmempoolancestors (const JSONRPCRequest& request)
@@ -566,6 +566,7 @@ static UniValue getmempoolancestors(const JSONRPCRequest& request)
566
566
567
567
uint256 hash = ParseHashV (request.params [0 ], " parameter 1" );
568
568
569
+ const CTxMemPool& mempool = EnsureMemPool ();
569
570
LOCK (mempool.cs );
570
571
571
572
CTxMemPool::txiter it = mempool.mapTx .find (hash);
@@ -591,7 +592,7 @@ static UniValue getmempoolancestors(const JSONRPCRequest& request)
591
592
const CTxMemPoolEntry &e = *ancestorIt;
592
593
const uint256& _hash = e.GetTx ().GetHash ();
593
594
UniValue info (UniValue::VOBJ);
594
- entryToJSON (:: mempool, info, e);
595
+ entryToJSON (mempool, info, e);
595
596
o.pushKV (_hash.ToString (), info);
596
597
}
597
598
return o;
@@ -633,6 +634,7 @@ static UniValue getmempooldescendants(const JSONRPCRequest& request)
633
634
634
635
uint256 hash = ParseHashV (request.params [0 ], " parameter 1" );
635
636
637
+ const CTxMemPool& mempool = EnsureMemPool ();
636
638
LOCK (mempool.cs );
637
639
638
640
CTxMemPool::txiter it = mempool.mapTx .find (hash);
@@ -658,7 +660,7 @@ static UniValue getmempooldescendants(const JSONRPCRequest& request)
658
660
const CTxMemPoolEntry &e = *descendantIt;
659
661
const uint256& _hash = e.GetTx ().GetHash ();
660
662
UniValue info (UniValue::VOBJ);
661
- entryToJSON (:: mempool, info, e);
663
+ entryToJSON (mempool, info, e);
662
664
o.pushKV (_hash.ToString (), info);
663
665
}
664
666
return o;
@@ -685,6 +687,7 @@ static UniValue getmempoolentry(const JSONRPCRequest& request)
685
687
686
688
uint256 hash = ParseHashV (request.params [0 ], " parameter 1" );
687
689
690
+ const CTxMemPool& mempool = EnsureMemPool ();
688
691
LOCK (mempool.cs );
689
692
690
693
CTxMemPool::txiter it = mempool.mapTx .find (hash);
@@ -694,7 +697,7 @@ static UniValue getmempoolentry(const JSONRPCRequest& request)
694
697
695
698
const CTxMemPoolEntry &e = *it;
696
699
UniValue info (UniValue::VOBJ);
697
- entryToJSON (:: mempool, info, e);
700
+ entryToJSON (mempool, info, e);
698
701
return info;
699
702
}
700
703
@@ -1070,6 +1073,7 @@ UniValue gettxout(const JSONRPCRequest& request)
1070
1073
CCoinsViewCache* coins_view = &::ChainstateActive ().CoinsTip ();
1071
1074
1072
1075
if (fMempool ) {
1076
+ const CTxMemPool& mempool = EnsureMemPool ();
1073
1077
LOCK (mempool.cs );
1074
1078
CCoinsViewMemPool view (coins_view, mempool);
1075
1079
if (!view.GetCoin (out, coin) || mempool.isSpent (out)) {
@@ -1448,7 +1452,7 @@ static UniValue getmempoolinfo(const JSONRPCRequest& request)
1448
1452
},
1449
1453
}.Check (request);
1450
1454
1451
- return MempoolInfoToJSON (::mempool );
1455
+ return MempoolInfoToJSON (EnsureMemPool () );
1452
1456
}
1453
1457
1454
1458
static UniValue preciousblock (const JSONRPCRequest& request)
@@ -1964,11 +1968,13 @@ static UniValue savemempool(const JSONRPCRequest& request)
1964
1968
},
1965
1969
}.Check (request);
1966
1970
1967
- if (!::mempool.IsLoaded ()) {
1971
+ const CTxMemPool& mempool = EnsureMemPool ();
1972
+
1973
+ if (!mempool.IsLoaded ()) {
1968
1974
throw JSONRPCError (RPC_MISC_ERROR, " The mempool was not loaded yet" );
1969
1975
}
1970
1976
1971
- if (!DumpMempool (:: mempool)) {
1977
+ if (!DumpMempool (mempool)) {
1972
1978
throw JSONRPCError (RPC_MISC_ERROR, " Unable to dump mempool to disk" );
1973
1979
}
1974
1980
0 commit comments