@ -28,7 +28,6 @@
@@ -28,7 +28,6 @@
# include <mutex>
# include <condition_variable>
using namespace std ;
struct CUpdatedBlock
{
@ -154,7 +153,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
@@ -154,7 +153,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
UniValue getblockcount ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 0 )
throw runtime_error (
throw std : : runtime_error (
" getblockcount \n "
" \n Returns the number of blocks in the longest blockchain. \n "
" \n Result: \n "
@ -171,7 +170,7 @@ UniValue getblockcount(const JSONRPCRequest& request)
@@ -171,7 +170,7 @@ UniValue getblockcount(const JSONRPCRequest& request)
UniValue getbestblockhash ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 0 )
throw runtime_error (
throw std : : runtime_error (
" getbestblockhash \n "
" \n Returns the hash of the best (tip) block in the longest blockchain. \n "
" \n Result: \n "
@ -198,7 +197,7 @@ void RPCNotifyBlockChange(bool ibd, const CBlockIndex * pindex)
@@ -198,7 +197,7 @@ void RPCNotifyBlockChange(bool ibd, const CBlockIndex * pindex)
UniValue waitfornewblock ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) > 1 )
throw runtime_error (
throw std : : runtime_error (
" waitfornewblock (timeout) \n "
" \n Waits for a specific new block and returns useful info about it. \n "
" \n Returns the current block on timeout or exit. \n "
@ -236,7 +235,7 @@ UniValue waitfornewblock(const JSONRPCRequest& request)
@@ -236,7 +235,7 @@ UniValue waitfornewblock(const JSONRPCRequest& request)
UniValue waitforblock ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) < 1 | | request . params . size ( ) > 2 )
throw runtime_error (
throw std : : runtime_error (
" waitforblock <blockhash> (timeout) \n "
" \n Waits for a specific new block and returns useful info about it. \n "
" \n Returns the current block on timeout or exit. \n "
@ -278,7 +277,7 @@ UniValue waitforblock(const JSONRPCRequest& request)
@@ -278,7 +277,7 @@ UniValue waitforblock(const JSONRPCRequest& request)
UniValue waitforblockheight ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) < 1 | | request . params . size ( ) > 2 )
throw runtime_error (
throw std : : runtime_error (
" waitforblockheight <height> (timeout) \n "
" \n Waits for (at least) block height and returns the height and hash \n "
" of the current tip. \n "
@ -320,7 +319,7 @@ UniValue waitforblockheight(const JSONRPCRequest& request)
@@ -320,7 +319,7 @@ UniValue waitforblockheight(const JSONRPCRequest& request)
UniValue getdifficulty ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 0 )
throw runtime_error (
throw std : : runtime_error (
" getdifficulty \n "
" \n Returns the proof-of-work difficulty as a multiple of the minimum difficulty. \n "
" \n Result: \n "
@ -368,7 +367,7 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
@@ -368,7 +367,7 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
info . push_back ( Pair ( " ancestorsize " , e . GetSizeWithAncestors ( ) ) ) ;
info . push_back ( Pair ( " ancestorfees " , e . GetModFeesWithAncestors ( ) ) ) ;
const CTransaction & tx = e . GetTx ( ) ;
set < string > setDepends ;
std : : s et < std : : string > setDepends ;
BOOST_FOREACH ( const CTxIn & txin , tx . vin )
{
if ( mempool . exists ( txin . prevout . hash ) )
@ -376,7 +375,7 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
@@ -376,7 +375,7 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
}
UniValue depends ( UniValue : : VARR ) ;
BOOST_FOREACH ( const string & dep , setDepends )
BOOST_FOREACH ( const std : : st ring & dep , setDepends )
{
depends . push_back ( dep ) ;
}
@ -401,7 +400,7 @@ UniValue mempoolToJSON(bool fVerbose = false)
@@ -401,7 +400,7 @@ UniValue mempoolToJSON(bool fVerbose = false)
}
else
{
vector < uint256 > vtxid ;
std : : vector < uint256 > vtxid ;
mempool . queryHashes ( vtxid ) ;
UniValue a ( UniValue : : VARR ) ;
@ -415,7 +414,7 @@ UniValue mempoolToJSON(bool fVerbose = false)
@@ -415,7 +414,7 @@ UniValue mempoolToJSON(bool fVerbose = false)
UniValue getrawmempool ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) > 1 )
throw runtime_error (
throw std : : runtime_error (
" getrawmempool ( verbose ) \n "
" \n Returns all transaction ids in memory pool as a json array of string transaction ids. \n "
" \n Arguments: \n "
@ -446,7 +445,7 @@ UniValue getrawmempool(const JSONRPCRequest& request)
@@ -446,7 +445,7 @@ UniValue getrawmempool(const JSONRPCRequest& request)
UniValue getmempoolancestors ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) < 1 | | request . params . size ( ) > 2 ) {
throw runtime_error (
throw std : : runtime_error (
" getmempoolancestors txid (verbose) \n "
" \n If txid is in the mempool, returns all in-mempool ancestors. \n "
" \n Arguments: \n "
@ -510,7 +509,7 @@ UniValue getmempoolancestors(const JSONRPCRequest& request)
@@ -510,7 +509,7 @@ UniValue getmempoolancestors(const JSONRPCRequest& request)
UniValue getmempooldescendants ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) < 1 | | request . params . size ( ) > 2 ) {
throw runtime_error (
throw std : : runtime_error (
" getmempooldescendants txid (verbose) \n "
" \n If txid is in the mempool, returns all in-mempool descendants. \n "
" \n Arguments: \n "
@ -574,7 +573,7 @@ UniValue getmempooldescendants(const JSONRPCRequest& request)
@@ -574,7 +573,7 @@ UniValue getmempooldescendants(const JSONRPCRequest& request)
UniValue getmempoolentry ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 1 ) {
throw runtime_error (
throw std : : runtime_error (
" getmempoolentry txid \n "
" \n Returns mempool data for given transaction \n "
" \n Arguments: \n "
@ -607,7 +606,7 @@ UniValue getmempoolentry(const JSONRPCRequest& request)
@@ -607,7 +606,7 @@ UniValue getmempoolentry(const JSONRPCRequest& request)
UniValue getblockhash ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 1 )
throw runtime_error (
throw std : : runtime_error (
" getblockhash height \n "
" \n Returns hash of block in best-block-chain at height provided. \n "
" \n Arguments: \n "
@ -632,7 +631,7 @@ UniValue getblockhash(const JSONRPCRequest& request)
@@ -632,7 +631,7 @@ UniValue getblockhash(const JSONRPCRequest& request)
UniValue getblockheader ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) < 1 | | request . params . size ( ) > 2 )
throw runtime_error (
throw std : : runtime_error (
" getblockheader \" hash \" ( verbose ) \n "
" \n If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'. \n "
" If verbose is true, returns an Object with information about blockheader <hash>. \n "
@ -691,7 +690,7 @@ UniValue getblockheader(const JSONRPCRequest& request)
@@ -691,7 +690,7 @@ UniValue getblockheader(const JSONRPCRequest& request)
UniValue getblock ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) < 1 | | request . params . size ( ) > 2 )
throw runtime_error (
throw std : : runtime_error (
" getblock \" blockhash \" ( verbose ) \n "
" \n If verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'. \n "
" 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,7 +817,7 @@ static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
UniValue pruneblockchain ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 1 )
throw runtime_error (
throw std : : runtime_error (
" pruneblockchain \n "
" \n Arguments: \n "
" 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,7 +866,7 @@ UniValue pruneblockchain(const JSONRPCRequest& request)
UniValue gettxoutsetinfo ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 0 )
throw runtime_error (
throw std : : runtime_error (
" gettxoutsetinfo \n "
" \n Returns statistics about the unspent transaction output set. \n "
" Note this call may take some time. \n "
@ -907,7 +906,7 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
@@ -907,7 +906,7 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
UniValue gettxout ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) < 2 | | request . params . size ( ) > 3 )
throw runtime_error (
throw std : : runtime_error (
" gettxout \" txid \" n ( include_mempool ) \n "
" \n Returns details about an unspent transaction output. \n "
" \n Arguments: \n "
@ -989,7 +988,7 @@ UniValue verifychain(const JSONRPCRequest& request)
@@ -989,7 +988,7 @@ UniValue verifychain(const JSONRPCRequest& request)
int nCheckLevel = GetArg ( " -checklevel " , DEFAULT_CHECKLEVEL ) ;
int nCheckDepth = GetArg ( " -checkblocks " , DEFAULT_CHECKBLOCKS ) ;
if ( request . fHelp | | request . params . size ( ) > 2 )
throw runtime_error (
throw std : : runtime_error (
" verifychain ( checklevel nblocks ) \n "
" \n Verifies blockchain database. \n "
" \n Arguments: \n "
@ -1075,7 +1074,7 @@ void BIP9SoftForkDescPushBack(UniValue& bip9_softforks, const std::string &name,
@@ -1075,7 +1074,7 @@ void BIP9SoftForkDescPushBack(UniValue& bip9_softforks, const std::string &name,
UniValue getblockchaininfo ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 0 )
throw runtime_error (
throw std : : runtime_error (
" getblockchaininfo \n "
" Returns an object containing various state info regarding blockchain processing. \n "
" \n Result: \n "
@ -1168,7 +1167,7 @@ struct CompareBlocksByHeight
@@ -1168,7 +1167,7 @@ struct CompareBlocksByHeight
UniValue getchaintips ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 0 )
throw runtime_error (
throw std : : runtime_error (
" getchaintips \n "
" Return information about all known tips in the block tree, "
" including the main chain as well as orphaned branches. \n "
@ -1201,7 +1200,7 @@ UniValue getchaintips(const JSONRPCRequest& request)
@@ -1201,7 +1200,7 @@ UniValue getchaintips(const JSONRPCRequest& request)
LOCK ( cs_main ) ;
/*
* Idea : the set of chain tips is chainActive . tip , plus orphan blocks which do not have another orphan building off of them .
* Idea : the set of chain tips is chainActive . tip , plus orphan blocks which do not have another orphan building off of them .
* Algorithm :
* - Make one pass through mapBlockIndex , picking out the orphan blocks , and also storing a set of the orphan block ' s pprev pointers .
* - 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,7 +1239,7 @@ UniValue getchaintips(const JSONRPCRequest& request)
const int branchLen = block - > nHeight - chainActive . FindFork ( block ) - > nHeight ;
obj . push_back ( Pair ( " branchlen " , branchLen ) ) ;
string status ;
std : : st ring status ;
if ( chainActive . Contains ( block ) ) {
// This block is part of the currently active chain.
status = " active " ;
@ -1284,7 +1283,7 @@ UniValue mempoolInfoToJSON()
@@ -1284,7 +1283,7 @@ UniValue mempoolInfoToJSON()
UniValue getmempoolinfo ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 0 )
throw runtime_error (
throw std : : runtime_error (
" getmempoolinfo \n "
" \n Returns details on the active state of the TX memory pool. \n "
" \n Result: \n "
@ -1306,7 +1305,7 @@ UniValue getmempoolinfo(const JSONRPCRequest& request)
@@ -1306,7 +1305,7 @@ UniValue getmempoolinfo(const JSONRPCRequest& request)
UniValue preciousblock ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 1 )
throw runtime_error (
throw std : : runtime_error (
" preciousblock \" blockhash \" \n "
" \n Treats a block as if it were received before others with the same work. \n "
" \n A later preciousblock call can override the effect of an earlier one. \n "
@ -1344,7 +1343,7 @@ UniValue preciousblock(const JSONRPCRequest& request)
@@ -1344,7 +1343,7 @@ UniValue preciousblock(const JSONRPCRequest& request)
UniValue invalidateblock ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 1 )
throw runtime_error (
throw std : : runtime_error (
" invalidateblock \" blockhash \" \n "
" \n Permanently marks a block as invalid, as if it violated a consensus rule. \n "
" \n Arguments: \n "
@ -1382,7 +1381,7 @@ UniValue invalidateblock(const JSONRPCRequest& request)
@@ -1382,7 +1381,7 @@ UniValue invalidateblock(const JSONRPCRequest& request)
UniValue reconsiderblock ( const JSONRPCRequest & request )
{
if ( request . fHelp | | request . params . size ( ) ! = 1 )
throw runtime_error (
throw std : : runtime_error (
" reconsiderblock \" blockhash \" \n "
" \n Removes invalidity status of a block and its descendants, reconsider them for activation. \n "
" This can be used to undo the effects of invalidateblock. \n "