28
28
29
29
#include < mutex>
30
30
#include < condition_variable>
31
- using namespace std ;
32
31
33
32
struct CUpdatedBlock
34
33
{
@@ -154,7 +153,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
154
153
UniValue getblockcount (const JSONRPCRequest& request)
155
154
{
156
155
if (request.fHelp || request.params .size () != 0 )
157
- throw runtime_error (
156
+ throw std:: runtime_error (
158
157
" getblockcount\n "
159
158
" \n Returns the number of blocks in the longest blockchain.\n "
160
159
" \n Result:\n "
@@ -171,7 +170,7 @@ UniValue getblockcount(const JSONRPCRequest& request)
171
170
UniValue getbestblockhash (const JSONRPCRequest& request)
172
171
{
173
172
if (request.fHelp || request.params .size () != 0 )
174
- throw runtime_error (
173
+ throw std:: runtime_error (
175
174
" getbestblockhash\n "
176
175
" \n Returns the hash of the best (tip) block in the longest blockchain.\n "
177
176
" \n Result:\n "
@@ -198,7 +197,7 @@ void RPCNotifyBlockChange(bool ibd, const CBlockIndex * pindex)
198
197
UniValue waitfornewblock (const JSONRPCRequest& request)
199
198
{
200
199
if (request.fHelp || request.params .size () > 1 )
201
- throw runtime_error (
200
+ throw std:: runtime_error (
202
201
" waitfornewblock (timeout)\n "
203
202
" \n Waits for a specific new block and returns useful info about it.\n "
204
203
" \n Returns the current block on timeout or exit.\n "
@@ -236,7 +235,7 @@ UniValue waitfornewblock(const JSONRPCRequest& request)
236
235
UniValue waitforblock (const JSONRPCRequest& request)
237
236
{
238
237
if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 )
239
- throw runtime_error (
238
+ throw std:: runtime_error (
240
239
" waitforblock <blockhash> (timeout)\n "
241
240
" \n Waits for a specific new block and returns useful info about it.\n "
242
241
" \n Returns the current block on timeout or exit.\n "
@@ -278,7 +277,7 @@ UniValue waitforblock(const JSONRPCRequest& request)
278
277
UniValue waitforblockheight (const JSONRPCRequest& request)
279
278
{
280
279
if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 )
281
- throw runtime_error (
280
+ throw std:: runtime_error (
282
281
" waitforblockheight <height> (timeout)\n "
283
282
" \n Waits for (at least) block height and returns the height and hash\n "
284
283
" of the current tip.\n "
@@ -320,7 +319,7 @@ UniValue waitforblockheight(const JSONRPCRequest& request)
320
319
UniValue getdifficulty (const JSONRPCRequest& request)
321
320
{
322
321
if (request.fHelp || request.params .size () != 0 )
323
- throw runtime_error (
322
+ throw std:: runtime_error (
324
323
" getdifficulty\n "
325
324
" \n Returns the proof-of-work difficulty as a multiple of the minimum difficulty.\n "
326
325
" \n Result:\n "
@@ -368,15 +367,15 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
368
367
info.push_back (Pair (" ancestorsize" , e.GetSizeWithAncestors ()));
369
368
info.push_back (Pair (" ancestorfees" , e.GetModFeesWithAncestors ()));
370
369
const CTransaction& tx = e.GetTx ();
371
- set<string> setDepends;
370
+ std:: set<std:: string> setDepends;
372
371
BOOST_FOREACH (const CTxIn& txin, tx.vin )
373
372
{
374
373
if (mempool.exists (txin.prevout .hash ))
375
374
setDepends.insert (txin.prevout .hash .ToString ());
376
375
}
377
376
378
377
UniValue depends (UniValue::VARR);
379
- BOOST_FOREACH (const string& dep, setDepends)
378
+ BOOST_FOREACH (const std:: string& dep, setDepends)
380
379
{
381
380
depends.push_back (dep);
382
381
}
@@ -401,7 +400,7 @@ UniValue mempoolToJSON(bool fVerbose = false)
401
400
}
402
401
else
403
402
{
404
- vector<uint256> vtxid;
403
+ std:: vector<uint256> vtxid;
405
404
mempool.queryHashes (vtxid);
406
405
407
406
UniValue a (UniValue::VARR);
@@ -415,7 +414,7 @@ UniValue mempoolToJSON(bool fVerbose = false)
415
414
UniValue getrawmempool (const JSONRPCRequest& request)
416
415
{
417
416
if (request.fHelp || request.params .size () > 1 )
418
- throw runtime_error (
417
+ throw std:: runtime_error (
419
418
" getrawmempool ( verbose )\n "
420
419
" \n Returns all transaction ids in memory pool as a json array of string transaction ids.\n "
421
420
" \n Arguments:\n "
@@ -446,7 +445,7 @@ UniValue getrawmempool(const JSONRPCRequest& request)
446
445
UniValue getmempoolancestors (const JSONRPCRequest& request)
447
446
{
448
447
if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 ) {
449
- throw runtime_error (
448
+ throw std:: runtime_error (
450
449
" getmempoolancestors txid (verbose)\n "
451
450
" \n If txid is in the mempool, returns all in-mempool ancestors.\n "
452
451
" \n Arguments:\n "
@@ -510,7 +509,7 @@ UniValue getmempoolancestors(const JSONRPCRequest& request)
510
509
UniValue getmempooldescendants (const JSONRPCRequest& request)
511
510
{
512
511
if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 ) {
513
- throw runtime_error (
512
+ throw std:: runtime_error (
514
513
" getmempooldescendants txid (verbose)\n "
515
514
" \n If txid is in the mempool, returns all in-mempool descendants.\n "
516
515
" \n Arguments:\n "
@@ -574,7 +573,7 @@ UniValue getmempooldescendants(const JSONRPCRequest& request)
574
573
UniValue getmempoolentry (const JSONRPCRequest& request)
575
574
{
576
575
if (request.fHelp || request.params .size () != 1 ) {
577
- throw runtime_error (
576
+ throw std:: runtime_error (
578
577
" getmempoolentry txid\n "
579
578
" \n Returns mempool data for given transaction\n "
580
579
" \n Arguments:\n "
@@ -607,7 +606,7 @@ UniValue getmempoolentry(const JSONRPCRequest& request)
607
606
UniValue getblockhash (const JSONRPCRequest& request)
608
607
{
609
608
if (request.fHelp || request.params .size () != 1 )
610
- throw runtime_error (
609
+ throw std:: runtime_error (
611
610
" getblockhash height\n "
612
611
" \n Returns hash of block in best-block-chain at height provided.\n "
613
612
" \n Arguments:\n "
@@ -632,7 +631,7 @@ UniValue getblockhash(const JSONRPCRequest& request)
632
631
UniValue getblockheader (const JSONRPCRequest& request)
633
632
{
634
633
if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 )
635
- throw runtime_error (
634
+ throw std:: runtime_error (
636
635
" getblockheader \" hash\" ( verbose )\n "
637
636
" \n If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.\n "
638
637
" If verbose is true, returns an Object with information about blockheader <hash>.\n "
@@ -691,7 +690,7 @@ UniValue getblockheader(const JSONRPCRequest& request)
691
690
UniValue getblock (const JSONRPCRequest& request)
692
691
{
693
692
if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 )
694
- throw runtime_error (
693
+ throw std:: runtime_error (
695
694
" getblock \" blockhash\" ( verbose )\n "
696
695
" \n If verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'.\n "
697
696
" If verbose is true, returns an Object with information about block <hash>.\n "
@@ -818,7 +817,7 @@ static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
818
817
UniValue pruneblockchain (const JSONRPCRequest& request)
819
818
{
820
819
if (request.fHelp || request.params .size () != 1 )
821
- throw runtime_error (
820
+ throw std:: runtime_error (
822
821
" pruneblockchain\n "
823
822
" \n Arguments:\n "
824
823
" 1. \" height\" (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp\n "
@@ -867,7 +866,7 @@ UniValue pruneblockchain(const JSONRPCRequest& request)
867
866
UniValue gettxoutsetinfo (const JSONRPCRequest& request)
868
867
{
869
868
if (request.fHelp || request.params .size () != 0 )
870
- throw runtime_error (
869
+ throw std:: runtime_error (
871
870
" gettxoutsetinfo\n "
872
871
" \n Returns statistics about the unspent transaction output set.\n "
873
872
" Note this call may take some time.\n "
@@ -907,7 +906,7 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
907
906
UniValue gettxout (const JSONRPCRequest& request)
908
907
{
909
908
if (request.fHelp || request.params .size () < 2 || request.params .size () > 3 )
910
- throw runtime_error (
909
+ throw std:: runtime_error (
911
910
" gettxout \" txid\" n ( include_mempool )\n "
912
911
" \n Returns details about an unspent transaction output.\n "
913
912
" \n Arguments:\n "
@@ -989,7 +988,7 @@ UniValue verifychain(const JSONRPCRequest& request)
989
988
int nCheckLevel = GetArg (" -checklevel" , DEFAULT_CHECKLEVEL);
990
989
int nCheckDepth = GetArg (" -checkblocks" , DEFAULT_CHECKBLOCKS);
991
990
if (request.fHelp || request.params .size () > 2 )
992
- throw runtime_error (
991
+ throw std:: runtime_error (
993
992
" verifychain ( checklevel nblocks )\n "
994
993
" \n Verifies blockchain database.\n "
995
994
" \n Arguments:\n "
@@ -1075,7 +1074,7 @@ void BIP9SoftForkDescPushBack(UniValue& bip9_softforks, const std::string &name,
1075
1074
UniValue getblockchaininfo (const JSONRPCRequest& request)
1076
1075
{
1077
1076
if (request.fHelp || request.params .size () != 0 )
1078
- throw runtime_error (
1077
+ throw std:: runtime_error (
1079
1078
" getblockchaininfo\n "
1080
1079
" Returns an object containing various state info regarding blockchain processing.\n "
1081
1080
" \n Result:\n "
@@ -1168,7 +1167,7 @@ struct CompareBlocksByHeight
1168
1167
UniValue getchaintips (const JSONRPCRequest& request)
1169
1168
{
1170
1169
if (request.fHelp || request.params .size () != 0 )
1171
- throw runtime_error (
1170
+ throw std:: runtime_error (
1172
1171
" getchaintips\n "
1173
1172
" Return information about all known tips in the block tree,"
1174
1173
" including the main chain as well as orphaned branches.\n "
@@ -1201,7 +1200,7 @@ UniValue getchaintips(const JSONRPCRequest& request)
1201
1200
LOCK (cs_main);
1202
1201
1203
1202
/*
1204
- * Idea: the set of chain tips is chainActive.tip, plus orphan blocks which do not have another orphan building off of them.
1203
+ * Idea: the set of chain tips is chainActive.tip, plus orphan blocks which do not have another orphan building off of them.
1205
1204
* Algorithm:
1206
1205
* - Make one pass through mapBlockIndex, picking out the orphan blocks, and also storing a set of the orphan block's pprev pointers.
1207
1206
* - Iterate through the orphan blocks. If the block isn't pointed to by another orphan, it is a chain tip.
@@ -1240,7 +1239,7 @@ UniValue getchaintips(const JSONRPCRequest& request)
1240
1239
const int branchLen = block->nHeight - chainActive.FindFork (block)->nHeight ;
1241
1240
obj.push_back (Pair (" branchlen" , branchLen));
1242
1241
1243
- string status;
1242
+ std:: string status;
1244
1243
if (chainActive.Contains (block)) {
1245
1244
// This block is part of the currently active chain.
1246
1245
status = " active" ;
@@ -1284,7 +1283,7 @@ UniValue mempoolInfoToJSON()
1284
1283
UniValue getmempoolinfo (const JSONRPCRequest& request)
1285
1284
{
1286
1285
if (request.fHelp || request.params .size () != 0 )
1287
- throw runtime_error (
1286
+ throw std:: runtime_error (
1288
1287
" getmempoolinfo\n "
1289
1288
" \n Returns details on the active state of the TX memory pool.\n "
1290
1289
" \n Result:\n "
@@ -1306,7 +1305,7 @@ UniValue getmempoolinfo(const JSONRPCRequest& request)
1306
1305
UniValue preciousblock (const JSONRPCRequest& request)
1307
1306
{
1308
1307
if (request.fHelp || request.params .size () != 1 )
1309
- throw runtime_error (
1308
+ throw std:: runtime_error (
1310
1309
" preciousblock \" blockhash\"\n "
1311
1310
" \n Treats a block as if it were received before others with the same work.\n "
1312
1311
" \n A later preciousblock call can override the effect of an earlier one.\n "
@@ -1344,7 +1343,7 @@ UniValue preciousblock(const JSONRPCRequest& request)
1344
1343
UniValue invalidateblock (const JSONRPCRequest& request)
1345
1344
{
1346
1345
if (request.fHelp || request.params .size () != 1 )
1347
- throw runtime_error (
1346
+ throw std:: runtime_error (
1348
1347
" invalidateblock \" blockhash\"\n "
1349
1348
" \n Permanently marks a block as invalid, as if it violated a consensus rule.\n "
1350
1349
" \n Arguments:\n "
@@ -1382,7 +1381,7 @@ UniValue invalidateblock(const JSONRPCRequest& request)
1382
1381
UniValue reconsiderblock (const JSONRPCRequest& request)
1383
1382
{
1384
1383
if (request.fHelp || request.params .size () != 1 )
1385
- throw runtime_error (
1384
+ throw std:: runtime_error (
1386
1385
" reconsiderblock \" blockhash\"\n "
1387
1386
" \n Removes invalidity status of a block and its descendants, reconsider them for activation.\n "
1388
1387
" This can be used to undo the effects of invalidateblock.\n "
0 commit comments