Make it clear which functions that are intended to be translation unit local

Do not share functions that are meant to be translation unit local with
other translation units. Use internal linkage for those consistently.
This commit is contained in:
practicalswift 2018-05-02 17:14:48 +02:00
parent 7eb7076f70
commit c3f34d06be
43 changed files with 226 additions and 226 deletions

View file

@ -48,7 +48,7 @@ static void PrevectorClear(benchmark::State& state)
} }
template <typename T> template <typename T>
void PrevectorResize(benchmark::State& state) static void PrevectorResize(benchmark::State& state)
{ {
while (state.KeepRunning()) { while (state.KeepRunning()) {
prevector<28, T> t0; prevector<28, T> t0;

View file

@ -29,7 +29,7 @@ static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
static const bool DEFAULT_NAMED=false; static const bool DEFAULT_NAMED=false;
static const int CONTINUE_EXECUTION=-1; static const int CONTINUE_EXECUTION=-1;
std::string HelpMessageCli() static std::string HelpMessageCli()
{ {
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN); const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET); const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
@ -138,7 +138,7 @@ struct HTTPReply
std::string body; std::string body;
}; };
const char *http_errorstring(int code) static const char *http_errorstring(int code)
{ {
switch(code) { switch(code) {
#if LIBEVENT_VERSION_NUMBER >= 0x02010300 #if LIBEVENT_VERSION_NUMBER >= 0x02010300
@ -387,7 +387,7 @@ static UniValue CallRPC(BaseRequestHandler *rh, const std::string& strMethod, co
return reply; return reply;
} }
int CommandLineRPC(int argc, char *argv[]) static int CommandLineRPC(int argc, char *argv[])
{ {
std::string strPrint; std::string strPrint;
int nRet = 0; int nRet = 0;

View file

@ -40,7 +40,7 @@
* Use the buttons <code>Namespaces</code>, <code>Classes</code> or <code>Files</code> at the top of the page to start navigating the code. * Use the buttons <code>Namespaces</code>, <code>Classes</code> or <code>Files</code> at the top of the page to start navigating the code.
*/ */
void WaitForShutdown() static void WaitForShutdown()
{ {
while (!ShutdownRequested()) while (!ShutdownRequested())
{ {
@ -53,7 +53,7 @@ void WaitForShutdown()
// //
// Start // Start
// //
bool AppInit(int argc, char* argv[]) static bool AppInit(int argc, char* argv[])
{ {
bool fRet = false; bool fRet = false;

View file

@ -88,7 +88,7 @@ CScript ParseScript(const std::string& s)
} }
// Check that all of the input and output scripts of a transaction contains valid opcodes // Check that all of the input and output scripts of a transaction contains valid opcodes
bool CheckTxScriptsSanity(const CMutableTransaction& tx) static bool CheckTxScriptsSanity(const CMutableTransaction& tx)
{ {
// Check input scripts for non-coinbase txs // Check input scripts for non-coinbase txs
if (!CTransaction(tx).IsCoinBase()) { if (!CTransaction(tx).IsCoinBase()) {

View file

@ -319,12 +319,12 @@ static void registerSignalHandler(int signal, void(*handler)(int))
} }
#endif #endif
void OnRPCStarted() static void OnRPCStarted()
{ {
uiInterface.NotifyBlockTip.connect(&RPCNotifyBlockChange); uiInterface.NotifyBlockTip.connect(&RPCNotifyBlockChange);
} }
void OnRPCStopped() static void OnRPCStopped()
{ {
uiInterface.NotifyBlockTip.disconnect(&RPCNotifyBlockChange); uiInterface.NotifyBlockTip.disconnect(&RPCNotifyBlockChange);
RPCNotifyBlockChange(false, nullptr); RPCNotifyBlockChange(false, nullptr);
@ -595,7 +595,7 @@ struct CImportingNow
// rev files since they'll be rewritten by the reindex anyway. This ensures that vinfoBlockFile // rev files since they'll be rewritten by the reindex anyway. This ensures that vinfoBlockFile
// is in sync with what's actually on disk by the time we start downloading, so that pruning // is in sync with what's actually on disk by the time we start downloading, so that pruning
// works correctly. // works correctly.
void CleanupBlockRevFiles() static void CleanupBlockRevFiles()
{ {
std::map<std::string, fs::path> mapBlockFiles; std::map<std::string, fs::path> mapBlockFiles;
@ -630,7 +630,7 @@ void CleanupBlockRevFiles()
} }
} }
void ThreadImport(std::vector<fs::path> vImportFiles) static void ThreadImport(std::vector<fs::path> vImportFiles)
{ {
const CChainParams& chainparams = Params(); const CChainParams& chainparams = Params();
RenameThread("bitcoin-loadblk"); RenameThread("bitcoin-loadblk");
@ -709,7 +709,7 @@ void ThreadImport(std::vector<fs::path> vImportFiles)
* Ensure that Bitcoin is running in a usable environment with all * Ensure that Bitcoin is running in a usable environment with all
* necessary library support. * necessary library support.
*/ */
bool InitSanityCheck(void) static bool InitSanityCheck(void)
{ {
if(!ECC_InitSanityCheck()) { if(!ECC_InitSanityCheck()) {
InitError("Elliptic curve cryptography sanity check failure. Aborting."); InitError("Elliptic curve cryptography sanity check failure. Aborting.");
@ -727,7 +727,7 @@ bool InitSanityCheck(void)
return true; return true;
} }
bool AppInitServers() static bool AppInitServers()
{ {
RPCServer::OnStarted(&OnRPCStarted); RPCServer::OnStarted(&OnRPCStarted);
RPCServer::OnStopped(&OnRPCStopped); RPCServer::OnStopped(&OnRPCStopped);

View file

@ -160,7 +160,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer, ServiceFlags nLocalServices)
return ret; return ret;
} }
int GetnScore(const CService& addr) static int GetnScore(const CService& addr)
{ {
LOCK(cs_mapLocalHost); LOCK(cs_mapLocalHost);
if (mapLocalHost.count(addr) == LOCAL_NONE) if (mapLocalHost.count(addr) == LOCAL_NONE)
@ -1466,7 +1466,7 @@ void CConnman::WakeMessageHandler()
#ifdef USE_UPNP #ifdef USE_UPNP
static CThreadInterrupt g_upnp_interrupt; static CThreadInterrupt g_upnp_interrupt;
static std::thread g_upnp_thread; static std::thread g_upnp_thread;
void ThreadMapPort() static void ThreadMapPort()
{ {
std::string port = strprintf("%u", GetListenPort()); std::string port = strprintf("%u", GetListenPort());
const char * multicastif = nullptr; const char * multicastif = nullptr;

View file

@ -277,7 +277,7 @@ CNodeState *State(NodeId pnode) {
return &it->second; return &it->second;
} }
void UpdatePreferredDownload(CNode* node, CNodeState* state) static void UpdatePreferredDownload(CNode* node, CNodeState* state)
{ {
nPreferredDownload -= state->fPreferredDownload; nPreferredDownload -= state->fPreferredDownload;
@ -287,7 +287,7 @@ void UpdatePreferredDownload(CNode* node, CNodeState* state)
nPreferredDownload += state->fPreferredDownload; nPreferredDownload += state->fPreferredDownload;
} }
void PushNodeVersion(CNode *pnode, CConnman* connman, int64_t nTime) static void PushNodeVersion(CNode *pnode, CConnman* connman, int64_t nTime)
{ {
ServiceFlags nLocalNodeServices = pnode->GetLocalServices(); ServiceFlags nLocalNodeServices = pnode->GetLocalServices();
uint64_t nonce = pnode->GetLocalNonce(); uint64_t nonce = pnode->GetLocalNonce();
@ -311,7 +311,7 @@ void PushNodeVersion(CNode *pnode, CConnman* connman, int64_t nTime)
// Requires cs_main. // Requires cs_main.
// Returns a bool indicating whether we requested this block. // Returns a bool indicating whether we requested this block.
// Also used if a block was /not/ received and timed out or started with another peer // Also used if a block was /not/ received and timed out or started with another peer
bool MarkBlockAsReceived(const uint256& hash) { static bool MarkBlockAsReceived(const uint256& hash) {
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash); std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash);
if (itInFlight != mapBlocksInFlight.end()) { if (itInFlight != mapBlocksInFlight.end()) {
CNodeState *state = State(itInFlight->second.first); CNodeState *state = State(itInFlight->second.first);
@ -337,7 +337,7 @@ bool MarkBlockAsReceived(const uint256& hash) {
// Requires cs_main. // Requires cs_main.
// returns false, still setting pit, if the block was already in flight from the same peer // returns false, still setting pit, if the block was already in flight from the same peer
// pit will only be valid as long as the same cs_main lock is being held // pit will only be valid as long as the same cs_main lock is being held
bool MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const CBlockIndex* pindex = nullptr, std::list<QueuedBlock>::iterator** pit = nullptr) { static bool MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const CBlockIndex* pindex = nullptr, std::list<QueuedBlock>::iterator** pit = nullptr) {
CNodeState *state = State(nodeid); CNodeState *state = State(nodeid);
assert(state != nullptr); assert(state != nullptr);
@ -371,7 +371,7 @@ bool MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const CBlockIndex*
} }
/** Check whether the last unknown block a peer advertised is not yet known. */ /** Check whether the last unknown block a peer advertised is not yet known. */
void ProcessBlockAvailability(NodeId nodeid) { static void ProcessBlockAvailability(NodeId nodeid) {
CNodeState *state = State(nodeid); CNodeState *state = State(nodeid);
assert(state != nullptr); assert(state != nullptr);
@ -387,7 +387,7 @@ void ProcessBlockAvailability(NodeId nodeid) {
} }
/** Update tracking information about which blocks a peer is assumed to have. */ /** Update tracking information about which blocks a peer is assumed to have. */
void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) { static void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
CNodeState *state = State(nodeid); CNodeState *state = State(nodeid);
assert(state != nullptr); assert(state != nullptr);
@ -411,7 +411,7 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
* lNodesAnnouncingHeaderAndIDs, and keeping that list under a certain size by * lNodesAnnouncingHeaderAndIDs, and keeping that list under a certain size by
* removing the first element if necessary. * removing the first element if necessary.
*/ */
void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman* connman) { static void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman* connman) {
AssertLockHeld(cs_main); AssertLockHeld(cs_main);
CNodeState* nodestate = State(nodeid); CNodeState* nodestate = State(nodeid);
if (!nodestate || !nodestate->fSupportsDesiredCmpctVersion) { if (!nodestate || !nodestate->fSupportsDesiredCmpctVersion) {
@ -444,7 +444,7 @@ void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman* connman) {
} }
} }
bool TipMayBeStale(const Consensus::Params &consensusParams) static bool TipMayBeStale(const Consensus::Params &consensusParams)
{ {
AssertLockHeld(cs_main); AssertLockHeld(cs_main);
if (g_last_tip_update == 0) { if (g_last_tip_update == 0) {
@ -454,13 +454,13 @@ bool TipMayBeStale(const Consensus::Params &consensusParams)
} }
// Requires cs_main // Requires cs_main
bool CanDirectFetch(const Consensus::Params &consensusParams) static bool CanDirectFetch(const Consensus::Params &consensusParams)
{ {
return chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - consensusParams.nPowTargetSpacing * 20; return chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - consensusParams.nPowTargetSpacing * 20;
} }
// Requires cs_main // Requires cs_main
bool PeerHasHeader(CNodeState *state, const CBlockIndex *pindex) static bool PeerHasHeader(CNodeState *state, const CBlockIndex *pindex)
{ {
if (state->pindexBestKnownBlock && pindex == state->pindexBestKnownBlock->GetAncestor(pindex->nHeight)) if (state->pindexBestKnownBlock && pindex == state->pindexBestKnownBlock->GetAncestor(pindex->nHeight))
return true; return true;
@ -471,7 +471,7 @@ bool PeerHasHeader(CNodeState *state, const CBlockIndex *pindex)
/** Update pindexLastCommonBlock and add not-in-flight missing successors to vBlocks, until it has /** Update pindexLastCommonBlock and add not-in-flight missing successors to vBlocks, until it has
* at most count entries. */ * at most count entries. */
void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<const CBlockIndex*>& vBlocks, NodeId& nodeStaller, const Consensus::Params& consensusParams) { static void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<const CBlockIndex*>& vBlocks, NodeId& nodeStaller, const Consensus::Params& consensusParams) {
if (count == 0) if (count == 0)
return; return;
@ -570,7 +570,7 @@ void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds)
// Returns true for outbound peers, excluding manual connections, feelers, and // Returns true for outbound peers, excluding manual connections, feelers, and
// one-shots // one-shots
bool IsOutboundDisconnectionCandidate(const CNode *node) static bool IsOutboundDisconnectionCandidate(const CNode *node)
{ {
return !(node->fInbound || node->m_manual_connection || node->fFeeler || node->fOneShot); return !(node->fInbound || node->m_manual_connection || node->fFeeler || node->fOneShot);
} }
@ -642,7 +642,7 @@ bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) {
// mapOrphanTransactions // mapOrphanTransactions
// //
void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans) static void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans)
{ {
size_t max_extra_txn = gArgs.GetArg("-blockreconstructionextratxn", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN); size_t max_extra_txn = gArgs.GetArg("-blockreconstructionextratxn", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN);
if (max_extra_txn <= 0) if (max_extra_txn <= 0)
@ -1280,7 +1280,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
} }
} }
uint32_t GetFetchFlags(CNode* pfrom) { static uint32_t GetFetchFlags(CNode* pfrom) {
uint32_t nFetchFlags = 0; uint32_t nFetchFlags = 0;
if ((pfrom->GetLocalServices() & NODE_WITNESS) && State(pfrom->GetId())->fHaveWitness) { if ((pfrom->GetLocalServices() & NODE_WITNESS) && State(pfrom->GetId())->fHaveWitness) {
nFetchFlags |= MSG_WITNESS_FLAG; nFetchFlags |= MSG_WITNESS_FLAG;

View file

@ -289,7 +289,7 @@ struct ProxyCredentials
}; };
/** Convert SOCKS5 reply to an error message */ /** Convert SOCKS5 reply to an error message */
std::string Socks5ErrorString(uint8_t err) static std::string Socks5ErrorString(uint8_t err)
{ {
switch(err) { switch(err) {
case SOCKS5Reply::GENFAILURE: case SOCKS5Reply::GENFAILURE:

View file

@ -178,7 +178,7 @@ static void RandAddSeedPerfmon()
/** Fallback: get 32 bytes of system entropy from /dev/urandom. The most /** Fallback: get 32 bytes of system entropy from /dev/urandom. The most
* compatible way to get cryptographic randomness on UNIX-ish platforms. * compatible way to get cryptographic randomness on UNIX-ish platforms.
*/ */
void GetDevURandom(unsigned char *ent32) static void GetDevURandom(unsigned char *ent32)
{ {
int f = open("/dev/urandom", O_RDONLY); int f = open("/dev/urandom", O_RDONLY);
if (f == -1) { if (f == -1) {

View file

@ -157,7 +157,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
return result; return result;
} }
UniValue getblockcount(const JSONRPCRequest& request) static UniValue getblockcount(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -174,7 +174,7 @@ UniValue getblockcount(const JSONRPCRequest& request)
return chainActive.Height(); return chainActive.Height();
} }
UniValue getbestblockhash(const JSONRPCRequest& request) static UniValue getbestblockhash(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -201,7 +201,7 @@ void RPCNotifyBlockChange(bool ibd, const CBlockIndex * pindex)
cond_blockchange.notify_all(); cond_blockchange.notify_all();
} }
UniValue waitfornewblock(const JSONRPCRequest& request) static UniValue waitfornewblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
@ -239,7 +239,7 @@ UniValue waitfornewblock(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue waitforblock(const JSONRPCRequest& request) static UniValue waitforblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
@ -281,7 +281,7 @@ UniValue waitforblock(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue waitforblockheight(const JSONRPCRequest& request) static UniValue waitforblockheight(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
@ -323,7 +323,7 @@ UniValue waitforblockheight(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue syncwithvalidationinterfacequeue(const JSONRPCRequest& request) static UniValue syncwithvalidationinterfacequeue(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 0) { if (request.fHelp || request.params.size() > 0) {
throw std::runtime_error( throw std::runtime_error(
@ -338,7 +338,7 @@ UniValue syncwithvalidationinterfacequeue(const JSONRPCRequest& request)
return NullUniValue; return NullUniValue;
} }
UniValue getdifficulty(const JSONRPCRequest& request) static UniValue getdifficulty(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -355,7 +355,7 @@ UniValue getdifficulty(const JSONRPCRequest& request)
return GetDifficulty(); return GetDifficulty();
} }
std::string EntryDescriptionString() static std::string EntryDescriptionString()
{ {
return " \"size\" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted.\n" return " \"size\" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted.\n"
" \"fee\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + " (DEPRECATED)\n" " \"fee\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + " (DEPRECATED)\n"
@ -383,7 +383,7 @@ std::string EntryDescriptionString()
" ... ]\n"; " ... ]\n";
} }
void entryToJSON(UniValue &info, const CTxMemPoolEntry &e) static void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
{ {
AssertLockHeld(mempool.cs); AssertLockHeld(mempool.cs);
@ -460,7 +460,7 @@ UniValue mempoolToJSON(bool fVerbose)
} }
} }
UniValue getrawmempool(const JSONRPCRequest& request) static UniValue getrawmempool(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
@ -492,7 +492,7 @@ UniValue getrawmempool(const JSONRPCRequest& request)
return mempoolToJSON(fVerbose); return mempoolToJSON(fVerbose);
} }
UniValue getmempoolancestors(const JSONRPCRequest& request) static UniValue getmempoolancestors(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
@ -556,7 +556,7 @@ UniValue getmempoolancestors(const JSONRPCRequest& request)
} }
} }
UniValue getmempooldescendants(const JSONRPCRequest& request) static UniValue getmempooldescendants(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
@ -620,7 +620,7 @@ UniValue getmempooldescendants(const JSONRPCRequest& request)
} }
} }
UniValue getmempoolentry(const JSONRPCRequest& request) static UniValue getmempoolentry(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) { if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error( throw std::runtime_error(
@ -653,7 +653,7 @@ UniValue getmempoolentry(const JSONRPCRequest& request)
return info; return info;
} }
UniValue getblockhash(const JSONRPCRequest& request) static UniValue getblockhash(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
@ -678,7 +678,7 @@ UniValue getblockhash(const JSONRPCRequest& request)
return pblockindex->GetBlockHash().GetHex(); return pblockindex->GetBlockHash().GetHex();
} }
UniValue getblockheader(const JSONRPCRequest& request) static UniValue getblockheader(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
@ -737,7 +737,7 @@ UniValue getblockheader(const JSONRPCRequest& request)
return blockheaderToJSON(pblockindex); return blockheaderToJSON(pblockindex);
} }
UniValue getblock(const JSONRPCRequest& request) static UniValue getblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
@ -899,7 +899,7 @@ static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
return true; return true;
} }
UniValue pruneblockchain(const JSONRPCRequest& request) static UniValue pruneblockchain(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
@ -948,7 +948,7 @@ UniValue pruneblockchain(const JSONRPCRequest& request)
return uint64_t(height); return uint64_t(height);
} }
UniValue gettxoutsetinfo(const JSONRPCRequest& request) static UniValue gettxoutsetinfo(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -1069,7 +1069,7 @@ UniValue gettxout(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue verifychain(const JSONRPCRequest& request) static UniValue verifychain(const JSONRPCRequest& request)
{ {
int nCheckLevel = gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL); int nCheckLevel = gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL);
int nCheckDepth = gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS); int nCheckDepth = gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS);
@ -1159,7 +1159,7 @@ static UniValue BIP9SoftForkDesc(const Consensus::Params& consensusParams, Conse
return rv; return rv;
} }
void BIP9SoftForkDescPushBack(UniValue& bip9_softforks, const Consensus::Params& consensusParams, Consensus::DeploymentPos id) static void BIP9SoftForkDescPushBack(UniValue& bip9_softforks, const Consensus::Params& consensusParams, Consensus::DeploymentPos id)
{ {
// Deployments with timeout value of 0 are hidden. // Deployments with timeout value of 0 are hidden.
// A timeout value of 0 guarantees a softfork will never be activated. // A timeout value of 0 guarantees a softfork will never be activated.
@ -1285,7 +1285,7 @@ struct CompareBlocksByHeight
} }
}; };
UniValue getchaintips(const JSONRPCRequest& request) static UniValue getchaintips(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -1402,7 +1402,7 @@ UniValue mempoolInfoToJSON()
return ret; return ret;
} }
UniValue getmempoolinfo(const JSONRPCRequest& request) static UniValue getmempoolinfo(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -1425,7 +1425,7 @@ UniValue getmempoolinfo(const JSONRPCRequest& request)
return mempoolInfoToJSON(); return mempoolInfoToJSON();
} }
UniValue preciousblock(const JSONRPCRequest& request) static UniValue preciousblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
@ -1463,7 +1463,7 @@ UniValue preciousblock(const JSONRPCRequest& request)
return NullUniValue; return NullUniValue;
} }
UniValue invalidateblock(const JSONRPCRequest& request) static UniValue invalidateblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
@ -1502,7 +1502,7 @@ UniValue invalidateblock(const JSONRPCRequest& request)
return NullUniValue; return NullUniValue;
} }
UniValue reconsiderblock(const JSONRPCRequest& request) static UniValue reconsiderblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
@ -1540,7 +1540,7 @@ UniValue reconsiderblock(const JSONRPCRequest& request)
return NullUniValue; return NullUniValue;
} }
UniValue getchaintxstats(const JSONRPCRequest& request) static UniValue getchaintxstats(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 2) if (request.fHelp || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
@ -1614,7 +1614,7 @@ UniValue getchaintxstats(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue savemempool(const JSONRPCRequest& request) static UniValue savemempool(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) { if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error( throw std::runtime_error(

View file

@ -44,7 +44,7 @@ unsigned int ParseConfirmTarget(const UniValue& value)
* or from the last difficulty change if 'lookup' is nonpositive. * or from the last difficulty change if 'lookup' is nonpositive.
* If 'height' is nonnegative, compute the estimate at the time when a given block was found. * If 'height' is nonnegative, compute the estimate at the time when a given block was found.
*/ */
UniValue GetNetworkHashPS(int lookup, int height) { static UniValue GetNetworkHashPS(int lookup, int height) {
CBlockIndex *pb = chainActive.Tip(); CBlockIndex *pb = chainActive.Tip();
if (height >= 0 && height < chainActive.Height()) if (height >= 0 && height < chainActive.Height())
@ -81,7 +81,7 @@ UniValue GetNetworkHashPS(int lookup, int height) {
return workDiff.getdouble() / timeDiff; return workDiff.getdouble() / timeDiff;
} }
UniValue getnetworkhashps(const JSONRPCRequest& request) static UniValue getnetworkhashps(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 2) if (request.fHelp || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
@ -151,7 +151,7 @@ UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGen
return blockHashes; return blockHashes;
} }
UniValue generatetoaddress(const JSONRPCRequest& request) static UniValue generatetoaddress(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
@ -185,7 +185,7 @@ UniValue generatetoaddress(const JSONRPCRequest& request)
return generateBlocks(coinbaseScript, nGenerate, nMaxTries, false); return generateBlocks(coinbaseScript, nGenerate, nMaxTries, false);
} }
UniValue getmininginfo(const JSONRPCRequest& request) static UniValue getmininginfo(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -224,7 +224,7 @@ UniValue getmininginfo(const JSONRPCRequest& request)
// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts // NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
UniValue prioritisetransaction(const JSONRPCRequest& request) static UniValue prioritisetransaction(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 3) if (request.fHelp || request.params.size() != 3)
throw std::runtime_error( throw std::runtime_error(
@ -278,7 +278,7 @@ static UniValue BIP22ValidationResult(const CValidationState& state)
return "valid?"; return "valid?";
} }
std::string gbt_vb_name(const Consensus::DeploymentPos pos) { static std::string gbt_vb_name(const Consensus::DeploymentPos pos) {
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos]; const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
std::string s = vbinfo.name; std::string s = vbinfo.name;
if (!vbinfo.gbt_force) { if (!vbinfo.gbt_force) {
@ -287,7 +287,7 @@ std::string gbt_vb_name(const Consensus::DeploymentPos pos) {
return s; return s;
} }
UniValue getblocktemplate(const JSONRPCRequest& request) static UniValue getblocktemplate(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
@ -694,7 +694,7 @@ protected:
} }
}; };
UniValue submitblock(const JSONRPCRequest& request) static UniValue submitblock(const JSONRPCRequest& request)
{ {
// We allow 2 arguments for compliance with BIP22. Argument 2 is ignored. // We allow 2 arguments for compliance with BIP22. Argument 2 is ignored.
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
@ -764,13 +764,13 @@ UniValue submitblock(const JSONRPCRequest& request)
return BIP22ValidationResult(sc.state); return BIP22ValidationResult(sc.state);
} }
UniValue estimatefee(const JSONRPCRequest& request) static UniValue estimatefee(const JSONRPCRequest& request)
{ {
throw JSONRPCError(RPC_METHOD_DEPRECATED, "estimatefee was removed in v0.17.\n" throw JSONRPCError(RPC_METHOD_DEPRECATED, "estimatefee was removed in v0.17.\n"
"Clients should use estimatesmartfee."); "Clients should use estimatesmartfee.");
} }
UniValue estimatesmartfee(const JSONRPCRequest& request) static UniValue estimatesmartfee(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
@ -831,7 +831,7 @@ UniValue estimatesmartfee(const JSONRPCRequest& request)
return result; return result;
} }
UniValue estimaterawfee(const JSONRPCRequest& request) static UniValue estimaterawfee(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(

View file

@ -33,7 +33,7 @@
#include <univalue.h> #include <univalue.h>
UniValue validateaddress(const JSONRPCRequest& request) static UniValue validateaddress(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
@ -90,7 +90,7 @@ UniValue validateaddress(const JSONRPCRequest& request)
// Needed even with !ENABLE_WALLET, to pass (ignored) pointers around // Needed even with !ENABLE_WALLET, to pass (ignored) pointers around
class CWallet; class CWallet;
UniValue createmultisig(const JSONRPCRequest& request) static UniValue createmultisig(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 2 || request.params.size() > 2) if (request.fHelp || request.params.size() < 2 || request.params.size() > 2)
{ {
@ -145,7 +145,7 @@ UniValue createmultisig(const JSONRPCRequest& request)
return result; return result;
} }
UniValue verifymessage(const JSONRPCRequest& request) static UniValue verifymessage(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 3) if (request.fHelp || request.params.size() != 3)
throw std::runtime_error( throw std::runtime_error(
@ -201,7 +201,7 @@ UniValue verifymessage(const JSONRPCRequest& request)
return (pubkey.GetID() == *keyID); return (pubkey.GetID() == *keyID);
} }
UniValue signmessagewithprivkey(const JSONRPCRequest& request) static UniValue signmessagewithprivkey(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 2) if (request.fHelp || request.params.size() != 2)
throw std::runtime_error( throw std::runtime_error(
@ -240,7 +240,7 @@ UniValue signmessagewithprivkey(const JSONRPCRequest& request)
return EncodeBase64(vchSig.data(), vchSig.size()); return EncodeBase64(vchSig.data(), vchSig.size());
} }
UniValue setmocktime(const JSONRPCRequest& request) static UniValue setmocktime(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
@ -299,7 +299,7 @@ static std::string RPCMallocInfo()
} }
#endif #endif
UniValue getmemoryinfo(const JSONRPCRequest& request) static UniValue getmemoryinfo(const JSONRPCRequest& request)
{ {
/* Please, avoid using the word "pool" here in the RPC interface or help, /* Please, avoid using the word "pool" here in the RPC interface or help,
* as users will undoubtedly confuse it with the other "memory pool" * as users will undoubtedly confuse it with the other "memory pool"
@ -346,7 +346,7 @@ UniValue getmemoryinfo(const JSONRPCRequest& request)
} }
} }
void EnableOrDisableLogCategories(UniValue cats, bool enable) { static void EnableOrDisableLogCategories(UniValue cats, bool enable) {
cats = cats.get_array(); cats = cats.get_array();
for (unsigned int i = 0; i < cats.size(); ++i) { for (unsigned int i = 0; i < cats.size(); ++i) {
std::string cat = cats[i].get_str(); std::string cat = cats[i].get_str();
@ -433,7 +433,7 @@ UniValue logging(const JSONRPCRequest& request)
return result; return result;
} }
UniValue echo(const JSONRPCRequest& request) static UniValue echo(const JSONRPCRequest& request)
{ {
if (request.fHelp) if (request.fHelp)
throw std::runtime_error( throw std::runtime_error(

View file

@ -23,7 +23,7 @@
#include <univalue.h> #include <univalue.h>
UniValue getconnectioncount(const JSONRPCRequest& request) static UniValue getconnectioncount(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -42,7 +42,7 @@ UniValue getconnectioncount(const JSONRPCRequest& request)
return (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL); return (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL);
} }
UniValue ping(const JSONRPCRequest& request) static UniValue ping(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -65,7 +65,7 @@ UniValue ping(const JSONRPCRequest& request)
return NullUniValue; return NullUniValue;
} }
UniValue getpeerinfo(const JSONRPCRequest& request) static UniValue getpeerinfo(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -190,7 +190,7 @@ UniValue getpeerinfo(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue addnode(const JSONRPCRequest& request) static UniValue addnode(const JSONRPCRequest& request)
{ {
std::string strCommand; std::string strCommand;
if (!request.params[1].isNull()) if (!request.params[1].isNull())
@ -237,7 +237,7 @@ UniValue addnode(const JSONRPCRequest& request)
return NullUniValue; return NullUniValue;
} }
UniValue disconnectnode(const JSONRPCRequest& request) static UniValue disconnectnode(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() == 0 || request.params.size() >= 3) if (request.fHelp || request.params.size() == 0 || request.params.size() >= 3)
throw std::runtime_error( throw std::runtime_error(
@ -280,7 +280,7 @@ UniValue disconnectnode(const JSONRPCRequest& request)
return NullUniValue; return NullUniValue;
} }
UniValue getaddednodeinfo(const JSONRPCRequest& request) static UniValue getaddednodeinfo(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
@ -347,7 +347,7 @@ UniValue getaddednodeinfo(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue getnettotals(const JSONRPCRequest& request) static UniValue getnettotals(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 0) if (request.fHelp || request.params.size() > 0)
throw std::runtime_error( throw std::runtime_error(
@ -413,7 +413,7 @@ static UniValue GetNetworksInfo()
return networks; return networks;
} }
UniValue getnetworkinfo(const JSONRPCRequest& request) static UniValue getnetworkinfo(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -489,7 +489,7 @@ UniValue getnetworkinfo(const JSONRPCRequest& request)
return obj; return obj;
} }
UniValue setban(const JSONRPCRequest& request) static UniValue setban(const JSONRPCRequest& request)
{ {
std::string strCommand; std::string strCommand;
if (!request.params[1].isNull()) if (!request.params[1].isNull())
@ -553,7 +553,7 @@ UniValue setban(const JSONRPCRequest& request)
return NullUniValue; return NullUniValue;
} }
UniValue listbanned(const JSONRPCRequest& request) static UniValue listbanned(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -586,7 +586,7 @@ UniValue listbanned(const JSONRPCRequest& request)
return bannedAddresses; return bannedAddresses;
} }
UniValue clearbanned(const JSONRPCRequest& request) static UniValue clearbanned(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -604,7 +604,7 @@ UniValue clearbanned(const JSONRPCRequest& request)
return NullUniValue; return NullUniValue;
} }
UniValue setnetworkactive(const JSONRPCRequest& request) static UniValue setnetworkactive(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) { if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error( throw std::runtime_error(

View file

@ -37,7 +37,7 @@
#include <univalue.h> #include <univalue.h>
void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
{ {
// Call into TxToUniv() in bitcoin-common to decode the transaction hex. // Call into TxToUniv() in bitcoin-common to decode the transaction hex.
// //
@ -63,7 +63,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
} }
} }
UniValue getrawtransaction(const JSONRPCRequest& request) static UniValue getrawtransaction(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
@ -203,7 +203,7 @@ UniValue getrawtransaction(const JSONRPCRequest& request)
return result; return result;
} }
UniValue gettxoutproof(const JSONRPCRequest& request) static UniValue gettxoutproof(const JSONRPCRequest& request)
{ {
if (request.fHelp || (request.params.size() != 1 && request.params.size() != 2)) if (request.fHelp || (request.params.size() != 1 && request.params.size() != 2))
throw std::runtime_error( throw std::runtime_error(
@ -297,7 +297,7 @@ UniValue gettxoutproof(const JSONRPCRequest& request)
return strHex; return strHex;
} }
UniValue verifytxoutproof(const JSONRPCRequest& request) static UniValue verifytxoutproof(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
@ -333,7 +333,7 @@ UniValue verifytxoutproof(const JSONRPCRequest& request)
return res; return res;
} }
UniValue createrawtransaction(const JSONRPCRequest& request) static UniValue createrawtransaction(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 2 || request.params.size() > 4) { if (request.fHelp || request.params.size() < 2 || request.params.size() > 4) {
throw std::runtime_error( throw std::runtime_error(
@ -493,7 +493,7 @@ UniValue createrawtransaction(const JSONRPCRequest& request)
return EncodeHexTx(rawTx); return EncodeHexTx(rawTx);
} }
UniValue decoderawtransaction(const JSONRPCRequest& request) static UniValue decoderawtransaction(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
@ -569,7 +569,7 @@ UniValue decoderawtransaction(const JSONRPCRequest& request)
return result; return result;
} }
UniValue decodescript(const JSONRPCRequest& request) static UniValue decodescript(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
@ -667,7 +667,7 @@ static void TxInErrorToJSON(const CTxIn& txin, UniValue& vErrorsRet, const std::
vErrorsRet.push_back(entry); vErrorsRet.push_back(entry);
} }
UniValue combinerawtransaction(const JSONRPCRequest& request) static UniValue combinerawtransaction(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
@ -906,7 +906,7 @@ UniValue SignTransaction(CMutableTransaction& mtx, const UniValue& prevTxsUnival
return result; return result;
} }
UniValue signrawtransactionwithkey(const JSONRPCRequest& request) static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 2 || request.params.size() > 4) if (request.fHelp || request.params.size() < 2 || request.params.size() > 4)
throw std::runtime_error( throw std::runtime_error(
@ -1084,7 +1084,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
} }
} }
UniValue sendrawtransaction(const JSONRPCRequest& request) static UniValue sendrawtransaction(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
@ -1179,7 +1179,7 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
return hashTx.GetHex(); return hashTx.GetHex();
} }
UniValue testmempoolaccept(const JSONRPCRequest& request) static UniValue testmempoolaccept(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(

View file

@ -239,7 +239,7 @@ UniValue stop(const JSONRPCRequest& jsonRequest)
return "Bitcoin server stopping"; return "Bitcoin server stopping";
} }
UniValue uptime(const JSONRPCRequest& jsonRequest) static UniValue uptime(const JSONRPCRequest& jsonRequest)
{ {
if (jsonRequest.fHelp || jsonRequest.params.size() > 1) if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(

View file

@ -141,7 +141,7 @@ Arena::Stats Arena::stats() const
} }
#ifdef ARENA_DEBUG #ifdef ARENA_DEBUG
void printchunk(char* base, size_t sz, bool used) { static void printchunk(char* base, size_t sz, bool used) {
std::cout << std::cout <<
"0x" << std::hex << std::setw(16) << std::setfill('0') << base << "0x" << std::hex << std::setw(16) << std::setfill('0') << base <<
" 0x" << std::hex << std::setw(16) << std::setfill('0') << sz << " 0x" << std::hex << std::setw(16) << std::setfill('0') << sz <<

View file

@ -31,7 +31,7 @@ struct COrphanTx {
}; };
extern std::map<uint256, COrphanTx> mapOrphanTransactions; extern std::map<uint256, COrphanTx> mapOrphanTransactions;
CService ip(uint32_t i) static CService ip(uint32_t i)
{ {
struct in_addr s; struct in_addr s;
s.s_addr = i; s.s_addr = i;
@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
peerLogic->FinalizeNode(dummyNode1.GetId(), dummy); peerLogic->FinalizeNode(dummyNode1.GetId(), dummy);
} }
void AddRandomOutboundPeer(std::vector<CNode *> &vNodes, PeerLogicValidation &peerLogic) static void AddRandomOutboundPeer(std::vector<CNode *> &vNodes, PeerLogicValidation &peerLogic)
{ {
CAddress addr(ip(GetRandInt(0xffffffff)), NODE_NONE); CAddress addr(ip(GetRandInt(0xffffffff)), NODE_NONE);
vNodes.emplace_back(new CNode(id++, ServiceFlags(NODE_NETWORK|NODE_WITNESS), 0, INVALID_SOCKET, addr, 0, 0, CAddress(), "", /*fInboundIn=*/ false)); vNodes.emplace_back(new CNode(id++, ServiceFlags(NODE_NETWORK|NODE_WITNESS), 0, INVALID_SOCKET, addr, 0, 0, CAddress(), "", /*fInboundIn=*/ false));
@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
peerLogic->FinalizeNode(dummyNode.GetId(), dummy); peerLogic->FinalizeNode(dummyNode.GetId(), dummy);
} }
CTransactionRef RandomOrphan() static CTransactionRef RandomOrphan()
{ {
std::map<uint256, COrphanTx>::iterator it; std::map<uint256, COrphanTx>::iterator it;
LOCK(cs_main); LOCK(cs_main);

View file

@ -17,7 +17,7 @@
BOOST_FIXTURE_TEST_SUITE(arith_uint256_tests, BasicTestingSetup) BOOST_FIXTURE_TEST_SUITE(arith_uint256_tests, BasicTestingSetup)
/// Convert vector to arith_uint256, via uint256 blob /// Convert vector to arith_uint256, via uint256 blob
inline arith_uint256 arith_uint256V(const std::vector<unsigned char>& vch) static inline arith_uint256 arith_uint256V(const std::vector<unsigned char>& vch)
{ {
return UintToArith256(uint256(vch)); return UintToArith256(uint256(vch));
} }
@ -53,7 +53,7 @@ const unsigned char MaxArray[] =
const arith_uint256 MaxL = arith_uint256V(std::vector<unsigned char>(MaxArray,MaxArray+32)); const arith_uint256 MaxL = arith_uint256V(std::vector<unsigned char>(MaxArray,MaxArray+32));
const arith_uint256 HalfL = (OneL << 255); const arith_uint256 HalfL = (OneL << 255);
std::string ArrayToString(const unsigned char A[], unsigned int width) static std::string ArrayToString(const unsigned char A[], unsigned int width)
{ {
std::stringstream Stream; std::stringstream Stream;
Stream << std::hex; Stream << std::hex;
@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE( basics ) // constructors, equality, inequality
tmpL = ~MaxL; BOOST_CHECK(tmpL == ~MaxL); tmpL = ~MaxL; BOOST_CHECK(tmpL == ~MaxL);
} }
void shiftArrayRight(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift) static void shiftArrayRight(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift)
{ {
for (unsigned int T=0; T < arrayLength; ++T) for (unsigned int T=0; T < arrayLength; ++T)
{ {
@ -136,7 +136,7 @@ void shiftArrayRight(unsigned char* to, const unsigned char* from, unsigned int
} }
} }
void shiftArrayLeft(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift) static void shiftArrayLeft(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift)
{ {
for (unsigned int T=0; T < arrayLength; ++T) for (unsigned int T=0; T < arrayLength; ++T)
{ {
@ -369,7 +369,7 @@ BOOST_AUTO_TEST_CASE( divide )
} }
bool almostEqual(double d1, double d2) static bool almostEqual(double d1, double d2)
{ {
return fabs(d1-d2) <= 4*fabs(d1)*std::numeric_limits<double>::epsilon(); return fabs(d1-d2) <= 4*fabs(d1)*std::numeric_limits<double>::epsilon();
} }

View file

@ -9,7 +9,7 @@
BOOST_FIXTURE_TEST_SUITE(bech32_tests, BasicTestingSetup) BOOST_FIXTURE_TEST_SUITE(bech32_tests, BasicTestingSetup)
bool CaseInsensitiveEqual(const std::string &s1, const std::string &s2) static bool CaseInsensitiveEqual(const std::string &s1, const std::string &s2)
{ {
if (s1.size() != s2.size()) return false; if (s1.size() != s2.size()) return false;
for (size_t i = 0; i < s1.size(); ++i) { for (size_t i = 0; i < s1.size(); ++i) {

View file

@ -87,7 +87,7 @@ TestVector test3 =
"xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L", "xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L",
0); 0);
void RunTest(const TestVector &test) { static void RunTest(const TestVector &test) {
std::vector<unsigned char> seed = ParseHex(test.strHexMaster); std::vector<unsigned char> seed = ParseHex(test.strHexMaster);
CExtKey key; CExtKey key;
CExtPubKey pubkey; CExtPubKey pubkey;

View file

@ -8,12 +8,12 @@
/* Equality between doubles is imprecise. Comparison should be done /* Equality between doubles is imprecise. Comparison should be done
* with a small threshold of tolerance, rather than exact equality. * with a small threshold of tolerance, rather than exact equality.
*/ */
bool DoubleEquals(double a, double b, double epsilon) static bool DoubleEquals(double a, double b, double epsilon)
{ {
return std::abs(a - b) < epsilon; return std::abs(a - b) < epsilon;
} }
CBlockIndex* CreateBlockIndexWithNbits(uint32_t nbits) static CBlockIndex* CreateBlockIndexWithNbits(uint32_t nbits)
{ {
CBlockIndex* block_index = new CBlockIndex(); CBlockIndex* block_index = new CBlockIndex();
block_index->nHeight = 46367; block_index->nHeight = 46367;
@ -22,7 +22,7 @@ CBlockIndex* CreateBlockIndexWithNbits(uint32_t nbits)
return block_index; return block_index;
} }
CChain CreateChainWithNbits(uint32_t nbits) static CChain CreateChainWithNbits(uint32_t nbits)
{ {
CBlockIndex* block_index = CreateBlockIndexWithNbits(nbits); CBlockIndex* block_index = CreateBlockIndexWithNbits(nbits);
CChain chain; CChain chain;
@ -30,7 +30,7 @@ CChain CreateChainWithNbits(uint32_t nbits)
return chain; return chain;
} }
void RejectDifficultyMismatch(double difficulty, double expected_difficulty) { static void RejectDifficultyMismatch(double difficulty, double expected_difficulty) {
BOOST_CHECK_MESSAGE( BOOST_CHECK_MESSAGE(
DoubleEquals(difficulty, expected_difficulty, 0.00001), DoubleEquals(difficulty, expected_difficulty, 0.00001),
"Difficulty was " + std::to_string(difficulty) "Difficulty was " + std::to_string(difficulty)
@ -40,7 +40,7 @@ void RejectDifficultyMismatch(double difficulty, double expected_difficulty) {
/* Given a BlockIndex with the provided nbits, /* Given a BlockIndex with the provided nbits,
* verify that the expected difficulty results. * verify that the expected difficulty results.
*/ */
void TestDifficulty(uint32_t nbits, double expected_difficulty) static void TestDifficulty(uint32_t nbits, double expected_difficulty)
{ {
CBlockIndex* block_index = CreateBlockIndexWithNbits(nbits); CBlockIndex* block_index = CreateBlockIndexWithNbits(nbits);
/* Since we are passing in block index explicitly, /* Since we are passing in block index explicitly,

View file

@ -146,7 +146,7 @@ typedef CCheckQueue<FrozenCleanupCheck> FrozenCleanup_Queue;
/** This test case checks that the CCheckQueue works properly /** This test case checks that the CCheckQueue works properly
* with each specified size_t Checks pushed. * with each specified size_t Checks pushed.
*/ */
void Correct_Queue_range(std::vector<size_t> range) static void Correct_Queue_range(std::vector<size_t> range)
{ {
auto small_queue = std::unique_ptr<Correct_Queue>(new Correct_Queue {QUEUE_BATCH_SIZE}); auto small_queue = std::unique_ptr<Correct_Queue>(new Correct_Queue {QUEUE_BATCH_SIZE});
boost::thread_group tg; boost::thread_group tg;

View file

@ -540,7 +540,7 @@ const static auto FLAGS = {char(0), FRESH, DIRTY, char(DIRTY | FRESH)};
const static auto CLEAN_FLAGS = {char(0), FRESH}; const static auto CLEAN_FLAGS = {char(0), FRESH};
const static auto ABSENT_FLAGS = {NO_ENTRY}; const static auto ABSENT_FLAGS = {NO_ENTRY};
void SetCoinsValue(CAmount value, Coin& coin) static void SetCoinsValue(CAmount value, Coin& coin)
{ {
assert(value != ABSENT); assert(value != ABSENT);
coin.Clear(); coin.Clear();
@ -552,7 +552,7 @@ void SetCoinsValue(CAmount value, Coin& coin)
} }
} }
size_t InsertCoinsMapEntry(CCoinsMap& map, CAmount value, char flags) static size_t InsertCoinsMapEntry(CCoinsMap& map, CAmount value, char flags)
{ {
if (value == ABSENT) { if (value == ABSENT) {
assert(flags == NO_ENTRY); assert(flags == NO_ENTRY);
@ -605,7 +605,7 @@ public:
CCoinsViewCacheTest cache{&base}; CCoinsViewCacheTest cache{&base};
}; };
void CheckAccessCoin(CAmount base_value, CAmount cache_value, CAmount expected_value, char cache_flags, char expected_flags) static void CheckAccessCoin(CAmount base_value, CAmount cache_value, CAmount expected_value, char cache_flags, char expected_flags)
{ {
SingleEntryCacheTest test(base_value, cache_value, cache_flags); SingleEntryCacheTest test(base_value, cache_value, cache_flags);
test.cache.AccessCoin(OUTPOINT); test.cache.AccessCoin(OUTPOINT);
@ -656,7 +656,7 @@ BOOST_AUTO_TEST_CASE(ccoins_access)
CheckAccessCoin(VALUE1, VALUE2, VALUE2, DIRTY|FRESH, DIRTY|FRESH); CheckAccessCoin(VALUE1, VALUE2, VALUE2, DIRTY|FRESH, DIRTY|FRESH);
} }
void CheckSpendCoins(CAmount base_value, CAmount cache_value, CAmount expected_value, char cache_flags, char expected_flags) static void CheckSpendCoins(CAmount base_value, CAmount cache_value, CAmount expected_value, char cache_flags, char expected_flags)
{ {
SingleEntryCacheTest test(base_value, cache_value, cache_flags); SingleEntryCacheTest test(base_value, cache_value, cache_flags);
test.cache.SpendCoin(OUTPOINT); test.cache.SpendCoin(OUTPOINT);
@ -707,7 +707,7 @@ BOOST_AUTO_TEST_CASE(ccoins_spend)
CheckSpendCoins(VALUE1, VALUE2, ABSENT, DIRTY|FRESH, NO_ENTRY ); CheckSpendCoins(VALUE1, VALUE2, ABSENT, DIRTY|FRESH, NO_ENTRY );
} }
void CheckAddCoinBase(CAmount base_value, CAmount cache_value, CAmount modify_value, CAmount expected_value, char cache_flags, char expected_flags, bool coinbase) static void CheckAddCoinBase(CAmount base_value, CAmount cache_value, CAmount modify_value, CAmount expected_value, char cache_flags, char expected_flags, bool coinbase)
{ {
SingleEntryCacheTest test(base_value, cache_value, cache_flags); SingleEntryCacheTest test(base_value, cache_value, cache_flags);
@ -734,7 +734,7 @@ void CheckAddCoinBase(CAmount base_value, CAmount cache_value, CAmount modify_va
// while still verifying that the CoinsViewCache::AddCoin implementation // while still verifying that the CoinsViewCache::AddCoin implementation
// ignores base values. // ignores base values.
template <typename... Args> template <typename... Args>
void CheckAddCoin(Args&&... args) static void CheckAddCoin(Args&&... args)
{ {
for (CAmount base_value : {ABSENT, PRUNED, VALUE1}) for (CAmount base_value : {ABSENT, PRUNED, VALUE1})
CheckAddCoinBase(base_value, std::forward<Args>(args)...); CheckAddCoinBase(base_value, std::forward<Args>(args)...);

View file

@ -23,7 +23,7 @@
BOOST_FIXTURE_TEST_SUITE(crypto_tests, BasicTestingSetup) BOOST_FIXTURE_TEST_SUITE(crypto_tests, BasicTestingSetup)
template<typename Hasher, typename In, typename Out> template<typename Hasher, typename In, typename Out>
void TestVector(const Hasher &h, const In &in, const Out &out) { static void TestVector(const Hasher &h, const In &in, const Out &out) {
Out hash; Out hash;
BOOST_CHECK(out.size() == h.OUTPUT_SIZE); BOOST_CHECK(out.size() == h.OUTPUT_SIZE);
hash.resize(out.size()); hash.resize(out.size());
@ -51,22 +51,22 @@ void TestVector(const Hasher &h, const In &in, const Out &out) {
} }
} }
void TestSHA1(const std::string &in, const std::string &hexout) { TestVector(CSHA1(), in, ParseHex(hexout));} static void TestSHA1(const std::string &in, const std::string &hexout) { TestVector(CSHA1(), in, ParseHex(hexout));}
void TestSHA256(const std::string &in, const std::string &hexout) { TestVector(CSHA256(), in, ParseHex(hexout));} static void TestSHA256(const std::string &in, const std::string &hexout) { TestVector(CSHA256(), in, ParseHex(hexout));}
void TestSHA512(const std::string &in, const std::string &hexout) { TestVector(CSHA512(), in, ParseHex(hexout));} static void TestSHA512(const std::string &in, const std::string &hexout) { TestVector(CSHA512(), in, ParseHex(hexout));}
void TestRIPEMD160(const std::string &in, const std::string &hexout) { TestVector(CRIPEMD160(), in, ParseHex(hexout));} static void TestRIPEMD160(const std::string &in, const std::string &hexout) { TestVector(CRIPEMD160(), in, ParseHex(hexout));}
void TestHMACSHA256(const std::string &hexkey, const std::string &hexin, const std::string &hexout) { static void TestHMACSHA256(const std::string &hexkey, const std::string &hexin, const std::string &hexout) {
std::vector<unsigned char> key = ParseHex(hexkey); std::vector<unsigned char> key = ParseHex(hexkey);
TestVector(CHMAC_SHA256(key.data(), key.size()), ParseHex(hexin), ParseHex(hexout)); TestVector(CHMAC_SHA256(key.data(), key.size()), ParseHex(hexin), ParseHex(hexout));
} }
void TestHMACSHA512(const std::string &hexkey, const std::string &hexin, const std::string &hexout) { static void TestHMACSHA512(const std::string &hexkey, const std::string &hexin, const std::string &hexout) {
std::vector<unsigned char> key = ParseHex(hexkey); std::vector<unsigned char> key = ParseHex(hexkey);
TestVector(CHMAC_SHA512(key.data(), key.size()), ParseHex(hexin), ParseHex(hexout)); TestVector(CHMAC_SHA512(key.data(), key.size()), ParseHex(hexin), ParseHex(hexout));
} }
void TestAES128(const std::string &hexkey, const std::string &hexin, const std::string &hexout) static void TestAES128(const std::string &hexkey, const std::string &hexin, const std::string &hexout)
{ {
std::vector<unsigned char> key = ParseHex(hexkey); std::vector<unsigned char> key = ParseHex(hexkey);
std::vector<unsigned char> in = ParseHex(hexin); std::vector<unsigned char> in = ParseHex(hexin);
@ -86,7 +86,7 @@ void TestAES128(const std::string &hexkey, const std::string &hexin, const std::
BOOST_CHECK_EQUAL(HexStr(buf2), HexStr(in)); BOOST_CHECK_EQUAL(HexStr(buf2), HexStr(in));
} }
void TestAES256(const std::string &hexkey, const std::string &hexin, const std::string &hexout) static void TestAES256(const std::string &hexkey, const std::string &hexin, const std::string &hexout)
{ {
std::vector<unsigned char> key = ParseHex(hexkey); std::vector<unsigned char> key = ParseHex(hexkey);
std::vector<unsigned char> in = ParseHex(hexin); std::vector<unsigned char> in = ParseHex(hexin);
@ -105,7 +105,7 @@ void TestAES256(const std::string &hexkey, const std::string &hexin, const std::
BOOST_CHECK(buf == in); BOOST_CHECK(buf == in);
} }
void TestAES128CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout) static void TestAES128CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout)
{ {
std::vector<unsigned char> key = ParseHex(hexkey); std::vector<unsigned char> key = ParseHex(hexkey);
std::vector<unsigned char> iv = ParseHex(hexiv); std::vector<unsigned char> iv = ParseHex(hexiv);
@ -146,7 +146,7 @@ void TestAES128CBC(const std::string &hexkey, const std::string &hexiv, bool pad
} }
} }
void TestAES256CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout) static void TestAES256CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout)
{ {
std::vector<unsigned char> key = ParseHex(hexkey); std::vector<unsigned char> key = ParseHex(hexkey);
std::vector<unsigned char> iv = ParseHex(hexiv); std::vector<unsigned char> iv = ParseHex(hexiv);
@ -187,7 +187,7 @@ void TestAES256CBC(const std::string &hexkey, const std::string &hexiv, bool pad
} }
} }
void TestChaCha20(const std::string &hexkey, uint64_t nonce, uint64_t seek, const std::string& hexout) static void TestChaCha20(const std::string &hexkey, uint64_t nonce, uint64_t seek, const std::string& hexout)
{ {
std::vector<unsigned char> key = ParseHex(hexkey); std::vector<unsigned char> key = ParseHex(hexkey);
ChaCha20 rng(key.data(), key.size()); ChaCha20 rng(key.data(), key.size());
@ -200,7 +200,7 @@ void TestChaCha20(const std::string &hexkey, uint64_t nonce, uint64_t seek, cons
BOOST_CHECK(out == outres); BOOST_CHECK(out == outres);
} }
std::string LongTestString(void) { static std::string LongTestString(void) {
std::string ret; std::string ret;
for (int i=0; i<200000; i++) { for (int i=0; i<200000; i++) {
ret += (unsigned char)(i); ret += (unsigned char)(i);

View file

@ -28,7 +28,7 @@ BOOST_AUTO_TEST_SUITE(cuckoocache_tests);
/** insecure_GetRandHash fills in a uint256 from local_rand_ctx /** insecure_GetRandHash fills in a uint256 from local_rand_ctx
*/ */
void insecure_GetRandHash(uint256& t) static void insecure_GetRandHash(uint256& t)
{ {
uint32_t* ptr = (uint32_t*)t.begin(); uint32_t* ptr = (uint32_t*)t.begin();
for (uint8_t j = 0; j < 8; ++j) for (uint8_t j = 0; j < 8; ++j)
@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(test_cuckoocache_no_fakes)
* inserted into a megabytes sized cache * inserted into a megabytes sized cache
*/ */
template <typename Cache> template <typename Cache>
double test_cache(size_t megabytes, double load) static double test_cache(size_t megabytes, double load)
{ {
local_rand_ctx = FastRandomContext(true); local_rand_ctx = FastRandomContext(true);
std::vector<uint256> hashes; std::vector<uint256> hashes;
@ -109,7 +109,7 @@ double test_cache(size_t megabytes, double load)
* how you measure around load 1.0 as after load 1.0 your normalized hit rate * how you measure around load 1.0 as after load 1.0 your normalized hit rate
* becomes effectively perfect, ignoring freshness. * becomes effectively perfect, ignoring freshness.
*/ */
double normalize_hit_rate(double hits, double load) static double normalize_hit_rate(double hits, double load)
{ {
return hits * std::max(load, 1.0); return hits * std::max(load, 1.0);
} }
@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(cuckoocache_hit_rate_ok)
/** This helper checks that erased elements are preferentially inserted onto and /** This helper checks that erased elements are preferentially inserted onto and
* that the hit rate of "fresher" keys is reasonable*/ * that the hit rate of "fresher" keys is reasonable*/
template <typename Cache> template <typename Cache>
void test_cache_erase(size_t megabytes) static void test_cache_erase(size_t megabytes)
{ {
double load = 1; double load = 1;
local_rand_ctx = FastRandomContext(true); local_rand_ctx = FastRandomContext(true);
@ -195,7 +195,7 @@ BOOST_AUTO_TEST_CASE(cuckoocache_erase_ok)
} }
template <typename Cache> template <typename Cache>
void test_cache_erase_parallel(size_t megabytes) static void test_cache_erase_parallel(size_t megabytes)
{ {
double load = 1; double load = 1;
local_rand_ctx = FastRandomContext(true); local_rand_ctx = FastRandomContext(true);
@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(cuckoocache_erase_parallel_ok)
template <typename Cache> template <typename Cache>
void test_cache_generations() static void test_cache_generations()
{ {
// This test checks that for a simulation of network activity, the fresh hit // This test checks that for a simulation of network activity, the fresh hit
// rate is never below 99%, and the number of times that it is worse than // rate is never below 99%, and the number of times that it is worse than

View file

@ -12,7 +12,7 @@
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
// Test if a string consists entirely of null characters // Test if a string consists entirely of null characters
bool is_null_key(const std::vector<unsigned char>& key) { static bool is_null_key(const std::vector<unsigned char>& key) {
bool isnull = true; bool isnull = true;
for (unsigned int i = 0; i < key.size(); i++) for (unsigned int i = 0; i < key.size(); i++)

View file

@ -58,8 +58,8 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test)
BOOST_CHECK_EQUAL(nSum, CAmount{2099999997690000}); BOOST_CHECK_EQUAL(nSum, CAmount{2099999997690000});
} }
bool ReturnFalse() { return false; } static bool ReturnFalse() { return false; }
bool ReturnTrue() { return true; } static bool ReturnTrue() { return true; }
BOOST_AUTO_TEST_CASE(test_combiner_all) BOOST_AUTO_TEST_CASE(test_combiner_all)
{ {

View file

@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
} }
template<typename name> template<typename name>
void CheckSort(CTxMemPool &pool, std::vector<std::string> &sortedOrder) static void CheckSort(CTxMemPool &pool, std::vector<std::string> &sortedOrder)
{ {
BOOST_CHECK_EQUAL(pool.size(), sortedOrder.size()); BOOST_CHECK_EQUAL(pool.size(), sortedOrder.size());
typename CTxMemPool::indexed_transaction_set::index<name>::type::iterator it = pool.mapTx.get<name>().begin(); typename CTxMemPool::indexed_transaction_set::index<name>::type::iterator it = pool.mapTx.get<name>().begin();

View file

@ -82,7 +82,7 @@ struct {
{2, 0xbbbeb305}, {2, 0xfe1c810a}, {2, 0xbbbeb305}, {2, 0xfe1c810a},
}; };
CBlockIndex CreateBlockIndex(int nHeight) static CBlockIndex CreateBlockIndex(int nHeight)
{ {
CBlockIndex index; CBlockIndex index;
index.nHeight = nHeight; index.nHeight = nHeight;
@ -90,7 +90,7 @@ CBlockIndex CreateBlockIndex(int nHeight)
return index; return index;
} }
bool TestSequenceLocks(const CTransaction &tx, int flags) static bool TestSequenceLocks(const CTransaction &tx, int flags)
{ {
LOCK(mempool.cs); LOCK(mempool.cs);
return CheckSequenceLocks(tx, flags); return CheckSequenceLocks(tx, flags);
@ -99,7 +99,7 @@ bool TestSequenceLocks(const CTransaction &tx, int flags)
// Test suite for ancestor feerate transaction selection. // Test suite for ancestor feerate transaction selection.
// Implemented as an additional function, rather than a separate test case, // Implemented as an additional function, rather than a separate test case,
// to allow reusing the blockchain created in CreateNewBlock_validity. // to allow reusing the blockchain created in CreateNewBlock_validity.
void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey, std::vector<CTransactionRef>& txFirst) static void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey, std::vector<CTransactionRef>& txFirst)
{ {
// Test the ancestor feerate transaction selection. // Test the ancestor feerate transaction selection.
TestMemPoolEntryHelper entry; TestMemPoolEntryHelper entry;

View file

@ -18,7 +18,7 @@
BOOST_FIXTURE_TEST_SUITE(multisig_tests, BasicTestingSetup) BOOST_FIXTURE_TEST_SUITE(multisig_tests, BasicTestingSetup)
CScript static CScript
sign_multisig(const CScript& scriptPubKey, const std::vector<CKey>& keys, const CTransaction& transaction, int whichIn) sign_multisig(const CScript& scriptPubKey, const std::vector<CKey>& keys, const CTransaction& transaction, int whichIn)
{ {
uint256 hash = SignatureHash(scriptPubKey, transaction, whichIn, SIGHASH_ALL, 0, SigVersion::BASE); uint256 hash = SignatureHash(scriptPubKey, transaction, whichIn, SIGHASH_ALL, 0, SigVersion::BASE);

View file

@ -63,7 +63,7 @@ public:
} }
}; };
CDataStream AddrmanToStream(CAddrManSerializationMock& _addrman) static CDataStream AddrmanToStream(CAddrManSerializationMock& _addrman)
{ {
CDataStream ssPeersIn(SER_DISK, CLIENT_VERSION); CDataStream ssPeersIn(SER_DISK, CLIENT_VERSION);
ssPeersIn << Params().MessageStart(); ssPeersIn << Params().MessageStart();

View file

@ -99,7 +99,7 @@ static ScriptErrorDesc script_errors[]={
{SCRIPT_ERR_WITNESS_PUBKEYTYPE, "WITNESS_PUBKEYTYPE"}, {SCRIPT_ERR_WITNESS_PUBKEYTYPE, "WITNESS_PUBKEYTYPE"},
}; };
const char *FormatScriptError(ScriptError_t err) static const char *FormatScriptError(ScriptError_t err)
{ {
for (unsigned int i=0; i<ARRAYLEN(script_errors); ++i) for (unsigned int i=0; i<ARRAYLEN(script_errors); ++i)
if (script_errors[i].err == err) if (script_errors[i].err == err)
@ -108,7 +108,7 @@ const char *FormatScriptError(ScriptError_t err)
return ""; return "";
} }
ScriptError_t ParseScriptError(const std::string &name) static ScriptError_t ParseScriptError(const std::string &name)
{ {
for (unsigned int i=0; i<ARRAYLEN(script_errors); ++i) for (unsigned int i=0; i<ARRAYLEN(script_errors); ++i)
if (script_errors[i].name == name) if (script_errors[i].name == name)
@ -1028,7 +1028,7 @@ BOOST_AUTO_TEST_CASE(script_PushData)
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
} }
CScript static CScript
sign_multisig(const CScript& scriptPubKey, const std::vector<CKey>& keys, const CTransaction& transaction) sign_multisig(const CScript& scriptPubKey, const std::vector<CKey>& keys, const CTransaction& transaction)
{ {
uint256 hash = SignatureHash(scriptPubKey, transaction, 0, SIGHASH_ALL, 0, SigVersion::BASE); uint256 hash = SignatureHash(scriptPubKey, transaction, 0, SIGHASH_ALL, 0, SigVersion::BASE);
@ -1052,7 +1052,7 @@ sign_multisig(const CScript& scriptPubKey, const std::vector<CKey>& keys, const
} }
return result; return result;
} }
CScript static CScript
sign_multisig(const CScript& scriptPubKey, const CKey& key, const CTransaction& transaction) sign_multisig(const CScript& scriptPubKey, const CKey& key, const CTransaction& transaction)
{ {
std::vector<CKey> keys; std::vector<CKey> keys;

View file

@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(GetSigOpCount)
* Verifies script execution of the zeroth scriptPubKey of tx output and * Verifies script execution of the zeroth scriptPubKey of tx output and
* zeroth scriptSig and witness of tx input. * zeroth scriptSig and witness of tx input.
*/ */
ScriptError VerifyWithFlag(const CTransaction& output, const CMutableTransaction& input, int flags) static ScriptError VerifyWithFlag(const CTransaction& output, const CMutableTransaction& input, int flags)
{ {
ScriptError error; ScriptError error;
CTransaction inputi(input); CTransaction inputi(input);
@ -82,7 +82,7 @@ ScriptError VerifyWithFlag(const CTransaction& output, const CMutableTransaction
* and witness such that spendingTx spends output zero of creationTx. * and witness such that spendingTx spends output zero of creationTx.
* Also inserts creationTx's output into the coins view. * Also inserts creationTx's output into the coins view.
*/ */
void BuildTxs(CMutableTransaction& spendingTx, CCoinsViewCache& coins, CMutableTransaction& creationTx, const CScript& scriptPubKey, const CScript& scriptSig, const CScriptWitness& witness) static void BuildTxs(CMutableTransaction& spendingTx, CCoinsViewCache& coins, CMutableTransaction& creationTx, const CScript& scriptPubKey, const CScript& scriptSig, const CScriptWitness& witness)
{ {
creationTx.nVersion = 1; creationTx.nVersion = 1;
creationTx.vin.resize(1); creationTx.vin.resize(1);

View file

@ -52,7 +52,7 @@ enum TEST_ID {
TEST_ID_END TEST_ID_END
}; };
bool read_stdin(std::vector<uint8_t> &data) { static bool read_stdin(std::vector<uint8_t> &data) {
uint8_t buffer[1024]; uint8_t buffer[1024];
ssize_t length=0; ssize_t length=0;
while((length = read(STDIN_FILENO, buffer, 1024)) > 0) { while((length = read(STDIN_FILENO, buffer, 1024)) > 0) {
@ -63,7 +63,7 @@ bool read_stdin(std::vector<uint8_t> &data) {
return length==0; return length==0;
} }
int test_one_input(std::vector<uint8_t> buffer) { static int test_one_input(std::vector<uint8_t> buffer) {
if (buffer.size() < sizeof(uint32_t)) return 0; if (buffer.size() < sizeof(uint32_t)) return 0;
uint32_t test_id = 0xffffffff; uint32_t test_id = 0xffffffff;

View file

@ -10,7 +10,7 @@
BOOST_FIXTURE_TEST_SUITE(torcontrol_tests, BasicTestingSetup) BOOST_FIXTURE_TEST_SUITE(torcontrol_tests, BasicTestingSetup)
void CheckSplitTorReplyLine(std::string input, std::string command, std::string args) static void CheckSplitTorReplyLine(std::string input, std::string command, std::string args)
{ {
BOOST_TEST_MESSAGE(std::string("CheckSplitTorReplyLine(") + input + ")"); BOOST_TEST_MESSAGE(std::string("CheckSplitTorReplyLine(") + input + ")");
auto ret = SplitTorReplyLine(input); auto ret = SplitTorReplyLine(input);
@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(util_SplitTorReplyLine)
CheckSplitTorReplyLine("COMMAND EVEN+more ARGS", "COMMAND", " EVEN+more ARGS"); CheckSplitTorReplyLine("COMMAND EVEN+more ARGS", "COMMAND", " EVEN+more ARGS");
} }
void CheckParseTorReplyMapping(std::string input, std::map<std::string,std::string> expected) static void CheckParseTorReplyMapping(std::string input, std::map<std::string,std::string> expected)
{ {
BOOST_TEST_MESSAGE(std::string("CheckParseTorReplyMapping(") + input + ")"); BOOST_TEST_MESSAGE(std::string("CheckParseTorReplyMapping(") + input + ")");
auto ret = ParseTorReplyMapping(input); auto ret = ParseTorReplyMapping(input);

View file

@ -343,7 +343,7 @@ BOOST_AUTO_TEST_CASE(test_Get)
BOOST_CHECK_EQUAL(coins.GetValueIn(t1), (50+21+22)*CENT); BOOST_CHECK_EQUAL(coins.GetValueIn(t1), (50+21+22)*CENT);
} }
void CreateCreditAndSpend(const CKeyStore& keystore, const CScript& outscript, CTransactionRef& output, CMutableTransaction& input, bool success = true) static void CreateCreditAndSpend(const CKeyStore& keystore, const CScript& outscript, CTransactionRef& output, CMutableTransaction& input, bool success = true)
{ {
CMutableTransaction outputm; CMutableTransaction outputm;
outputm.nVersion = 1; outputm.nVersion = 1;
@ -381,7 +381,7 @@ void CreateCreditAndSpend(const CKeyStore& keystore, const CScript& outscript, C
assert(input.vin[0].scriptWitness.stack == inputm.vin[0].scriptWitness.stack); assert(input.vin[0].scriptWitness.stack == inputm.vin[0].scriptWitness.stack);
} }
void CheckWithFlag(const CTransactionRef& output, const CMutableTransaction& input, int flags, bool success) static void CheckWithFlag(const CTransactionRef& output, const CMutableTransaction& input, int flags, bool success)
{ {
ScriptError error; ScriptError error;
CTransaction inputi(input); CTransaction inputi(input);
@ -404,7 +404,7 @@ static CScript PushAll(const std::vector<valtype>& values)
return result; return result;
} }
void ReplaceRedeemScript(CScript& script, const CScript& redeemScript) static void ReplaceRedeemScript(CScript& script, const CScript& redeemScript)
{ {
std::vector<valtype> stack; std::vector<valtype> stack;
EvalScript(stack, script, SCRIPT_VERIFY_STRICTENC, BaseSignatureChecker(), SigVersion::BASE); EvalScript(stack, script, SCRIPT_VERIFY_STRICTENC, BaseSignatureChecker(), SigVersion::BASE);

View file

@ -102,7 +102,7 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
// should fail. // should fail.
// Capture this interaction with the upgraded_nop argument: set it when evaluating // Capture this interaction with the upgraded_nop argument: set it when evaluating
// any script flag that is implemented as an upgraded NOP code. // any script flag that is implemented as an upgraded NOP code.
void ValidateCheckInputsForAllFlags(CMutableTransaction &tx, uint32_t failing_flags, bool add_to_cache) static void ValidateCheckInputsForAllFlags(CMutableTransaction &tx, uint32_t failing_flags, bool add_to_cache)
{ {
PrecomputedTransactionData txdata(tx); PrecomputedTransactionData txdata(tx);
// If we add many more flags, this loop can get too expensive, but we can // If we add many more flags, this loop can get too expensive, but we can

View file

@ -48,7 +48,7 @@ const unsigned char MaxArray[] =
const uint256 MaxL = uint256(std::vector<unsigned char>(MaxArray,MaxArray+32)); const uint256 MaxL = uint256(std::vector<unsigned char>(MaxArray,MaxArray+32));
const uint160 MaxS = uint160(std::vector<unsigned char>(MaxArray,MaxArray+20)); const uint160 MaxS = uint160(std::vector<unsigned char>(MaxArray,MaxArray+20));
std::string ArrayToString(const unsigned char A[], unsigned int width) static std::string ArrayToString(const unsigned char A[], unsigned int width)
{ {
std::stringstream Stream; std::stringstream Stream;
Stream << std::hex; Stream << std::hex;

View file

@ -12,7 +12,7 @@
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
/* Define a virtual block time, one block per 10 minutes after Nov 14 2014, 0:55:36am */ /* Define a virtual block time, one block per 10 minutes after Nov 14 2014, 0:55:36am */
int32_t TestTime(int nHeight) { return 1415926536 + 600 * nHeight; } static int32_t TestTime(int nHeight) { return 1415926536 + 600 * nHeight; }
static const Consensus::Params paramsDummy = Consensus::Params(); static const Consensus::Params paramsDummy = Consensus::Params();

View file

@ -477,7 +477,7 @@ static bool IsCurrentForFeeEstimation()
* and instead just erase from the mempool as needed. * and instead just erase from the mempool as needed.
*/ */
void UpdateMempoolForReorg(DisconnectedBlockTransactions &disconnectpool, bool fAddToMempool) static void UpdateMempoolForReorg(DisconnectedBlockTransactions &disconnectpool, bool fAddToMempool)
{ {
AssertLockHeld(cs_main); AssertLockHeld(cs_main);
std::vector<uint256> vHashUpdate; std::vector<uint256> vHashUpdate;
@ -1487,7 +1487,7 @@ static bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex *pindex)
} }
/** Abort with a message */ /** Abort with a message */
bool AbortNode(const std::string& strMessage, const std::string& userMessage="") static bool AbortNode(const std::string& strMessage, const std::string& userMessage="")
{ {
SetMiscWarning(strMessage); SetMiscWarning(strMessage);
LogPrintf("*** %s\n", strMessage); LogPrintf("*** %s\n", strMessage);
@ -1498,7 +1498,7 @@ bool AbortNode(const std::string& strMessage, const std::string& userMessage="")
return false; return false;
} }
bool AbortNode(CValidationState& state, const std::string& strMessage, const std::string& userMessage="") static bool AbortNode(CValidationState& state, const std::string& strMessage, const std::string& userMessage="")
{ {
AbortNode(strMessage, userMessage); AbortNode(strMessage, userMessage);
return state.Error(strMessage); return state.Error(strMessage);

View file

@ -51,7 +51,7 @@ std::string static EncodeDumpString(const std::string &str) {
return ret.str(); return ret.str();
} }
std::string DecodeDumpString(const std::string &str) { static std::string DecodeDumpString(const std::string &str) {
std::stringstream ret; std::stringstream ret;
for (unsigned int pos = 0; pos < str.length(); pos++) { for (unsigned int pos = 0; pos < str.length(); pos++) {
unsigned char c = str[pos]; unsigned char c = str[pos];
@ -65,7 +65,7 @@ std::string DecodeDumpString(const std::string &str) {
return ret.str(); return ret.str();
} }
bool GetWalletAddressesForKey(CWallet * const pwallet, const CKeyID &keyid, std::string &strAddr, std::string &strLabel) static bool GetWalletAddressesForKey(CWallet * const pwallet, const CKeyID &keyid, std::string &strAddr, std::string &strLabel)
{ {
bool fLabelFound = false; bool fLabelFound = false;
CKey key; CKey key;
@ -208,8 +208,8 @@ UniValue abortrescan(const JSONRPCRequest& request)
return true; return true;
} }
void ImportAddress(CWallet*, const CTxDestination& dest, const std::string& strLabel); static void ImportAddress(CWallet*, const CTxDestination& dest, const std::string& strLabel);
void ImportScript(CWallet* const pwallet, const CScript& script, const std::string& strLabel, bool isRedeemScript) static void ImportScript(CWallet* const pwallet, const CScript& script, const std::string& strLabel, bool isRedeemScript)
{ {
if (!isRedeemScript && ::IsMine(*pwallet, script) == ISMINE_SPENDABLE) { if (!isRedeemScript && ::IsMine(*pwallet, script) == ISMINE_SPENDABLE) {
throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script"); throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script");
@ -235,7 +235,7 @@ void ImportScript(CWallet* const pwallet, const CScript& script, const std::stri
} }
} }
void ImportAddress(CWallet* const pwallet, const CTxDestination& dest, const std::string& strLabel) static void ImportAddress(CWallet* const pwallet, const CTxDestination& dest, const std::string& strLabel)
{ {
CScript script = GetScriptForDestination(dest); CScript script = GetScriptForDestination(dest);
ImportScript(pwallet, script, strLabel, false); ImportScript(pwallet, script, strLabel, false);
@ -811,7 +811,7 @@ UniValue dumpwallet(const JSONRPCRequest& request)
} }
UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, const int64_t timestamp) static UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, const int64_t timestamp)
{ {
try { try {
bool success = false; bool success = false;
@ -1111,7 +1111,7 @@ UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, const int6
} }
} }
int64_t GetImportTimestamp(const UniValue& data, int64_t now) static int64_t GetImportTimestamp(const UniValue& data, int64_t now)
{ {
if (data.exists("timestamp")) { if (data.exists("timestamp")) {
const UniValue& timestamp = data["timestamp"]; const UniValue& timestamp = data["timestamp"];

View file

@ -85,7 +85,7 @@ void EnsureWalletIsUnlocked(CWallet * const pwallet)
} }
} }
void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) static void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
{ {
int confirms = wtx.GetDepthInMainChain(); int confirms = wtx.GetDepthInMainChain();
entry.pushKV("confirmations", confirms); entry.pushKV("confirmations", confirms);
@ -124,7 +124,7 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
entry.pushKV(item.first, item.second); entry.pushKV(item.first, item.second);
} }
std::string LabelFromValue(const UniValue& value) static std::string LabelFromValue(const UniValue& value)
{ {
std::string label = value.get_str(); std::string label = value.get_str();
if (label == "*") if (label == "*")
@ -132,7 +132,7 @@ std::string LabelFromValue(const UniValue& value)
return label; return label;
} }
UniValue getnewaddress(const JSONRPCRequest& request) static UniValue getnewaddress(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -196,7 +196,7 @@ CTxDestination GetLabelDestination(CWallet* const pwallet, const std::string& la
return dest; return dest;
} }
UniValue getlabeladdress(const JSONRPCRequest& request) static UniValue getlabeladdress(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -254,7 +254,7 @@ UniValue getlabeladdress(const JSONRPCRequest& request)
} }
UniValue getrawchangeaddress(const JSONRPCRequest& request) static UniValue getrawchangeaddress(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -302,7 +302,7 @@ UniValue getrawchangeaddress(const JSONRPCRequest& request)
} }
UniValue setlabel(const JSONRPCRequest& request) static UniValue setlabel(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -356,7 +356,7 @@ UniValue setlabel(const JSONRPCRequest& request)
} }
UniValue getaccount(const JSONRPCRequest& request) static UniValue getaccount(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -399,7 +399,7 @@ UniValue getaccount(const JSONRPCRequest& request)
} }
UniValue getaddressesbyaccount(const JSONRPCRequest& request) static UniValue getaddressesbyaccount(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -485,7 +485,7 @@ static CTransactionRef SendMoney(CWallet * const pwallet, const CTxDestination &
return tx; return tx;
} }
UniValue sendtoaddress(const JSONRPCRequest& request) static UniValue sendtoaddress(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -572,7 +572,7 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
return tx->GetHash().GetHex(); return tx->GetHash().GetHex();
} }
UniValue listaddressgroupings(const JSONRPCRequest& request) static UniValue listaddressgroupings(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -629,7 +629,7 @@ UniValue listaddressgroupings(const JSONRPCRequest& request)
return jsonGroupings; return jsonGroupings;
} }
UniValue signmessage(const JSONRPCRequest& request) static UniValue signmessage(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -690,7 +690,7 @@ UniValue signmessage(const JSONRPCRequest& request)
return EncodeBase64(vchSig.data(), vchSig.size()); return EncodeBase64(vchSig.data(), vchSig.size());
} }
UniValue getreceivedbyaddress(const JSONRPCRequest& request) static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -755,7 +755,7 @@ UniValue getreceivedbyaddress(const JSONRPCRequest& request)
} }
UniValue getreceivedbylabel(const JSONRPCRequest& request) static UniValue getreceivedbylabel(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -825,7 +825,7 @@ UniValue getreceivedbylabel(const JSONRPCRequest& request)
} }
UniValue getbalance(const JSONRPCRequest& request) static UniValue getbalance(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -908,7 +908,7 @@ UniValue getbalance(const JSONRPCRequest& request)
return ValueFromAmount(pwallet->GetBalance()); return ValueFromAmount(pwallet->GetBalance());
} }
UniValue getunconfirmedbalance(const JSONRPCRequest &request) static UniValue getunconfirmedbalance(const JSONRPCRequest &request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -930,7 +930,7 @@ UniValue getunconfirmedbalance(const JSONRPCRequest &request)
} }
UniValue movecmd(const JSONRPCRequest& request) static UniValue movecmd(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -987,7 +987,7 @@ UniValue movecmd(const JSONRPCRequest& request)
} }
UniValue sendfrom(const JSONRPCRequest& request) static UniValue sendfrom(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -1060,7 +1060,7 @@ UniValue sendfrom(const JSONRPCRequest& request)
} }
UniValue sendmany(const JSONRPCRequest& request) static UniValue sendmany(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -1255,7 +1255,7 @@ UniValue sendmany(const JSONRPCRequest& request)
return tx->GetHash().GetHex(); return tx->GetHash().GetHex();
} }
UniValue addmultisigaddress(const JSONRPCRequest& request) static UniValue addmultisigaddress(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -1390,7 +1390,7 @@ public:
bool operator()(const T& dest) { return false; } bool operator()(const T& dest) { return false; }
}; };
UniValue addwitnessaddress(const JSONRPCRequest& request) static UniValue addwitnessaddress(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -1476,7 +1476,7 @@ struct tallyitem
} }
}; };
UniValue ListReceived(CWallet * const pwallet, const UniValue& params, bool by_label) static UniValue ListReceived(CWallet * const pwallet, const UniValue& params, bool by_label)
{ {
// Minimum confirmations // Minimum confirmations
int nMinDepth = 1; int nMinDepth = 1;
@ -1622,7 +1622,7 @@ UniValue ListReceived(CWallet * const pwallet, const UniValue& params, bool by_l
return ret; return ret;
} }
UniValue listreceivedbyaddress(const JSONRPCRequest& request) static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -1671,7 +1671,7 @@ UniValue listreceivedbyaddress(const JSONRPCRequest& request)
return ListReceived(pwallet, request.params, false); return ListReceived(pwallet, request.params, false);
} }
UniValue listreceivedbylabel(const JSONRPCRequest& request) static UniValue listreceivedbylabel(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -1739,7 +1739,7 @@ static void MaybePushAddress(UniValue & entry, const CTxDestination &dest)
* @param ret The UniValue into which the result is stored. * @param ret The UniValue into which the result is stored.
* @param filter The "is mine" filter bool. * @param filter The "is mine" filter bool.
*/ */
void ListTransactions(CWallet* const pwallet, const CWalletTx& wtx, const std::string& strAccount, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter) static void ListTransactions(CWallet* const pwallet, const CWalletTx& wtx, const std::string& strAccount, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter)
{ {
CAmount nFee; CAmount nFee;
std::string strSentAccount; std::string strSentAccount;
@ -1819,7 +1819,7 @@ void ListTransactions(CWallet* const pwallet, const CWalletTx& wtx, const std::s
} }
} }
void AcentryToJSON(const CAccountingEntry& acentry, const std::string& strAccount, UniValue& ret) static void AcentryToJSON(const CAccountingEntry& acentry, const std::string& strAccount, UniValue& ret)
{ {
bool fAllAccounts = (strAccount == std::string("*")); bool fAllAccounts = (strAccount == std::string("*"));
@ -2024,7 +2024,7 @@ UniValue listtransactions(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue listaccounts(const JSONRPCRequest& request) static UniValue listaccounts(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2117,7 +2117,7 @@ UniValue listaccounts(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue listsinceblock(const JSONRPCRequest& request) static UniValue listsinceblock(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2256,7 +2256,7 @@ UniValue listsinceblock(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue gettransaction(const JSONRPCRequest& request) static UniValue gettransaction(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2350,7 +2350,7 @@ UniValue gettransaction(const JSONRPCRequest& request)
return entry; return entry;
} }
UniValue abandontransaction(const JSONRPCRequest& request) static UniValue abandontransaction(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2394,7 +2394,7 @@ UniValue abandontransaction(const JSONRPCRequest& request)
} }
UniValue backupwallet(const JSONRPCRequest& request) static UniValue backupwallet(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2427,7 +2427,7 @@ UniValue backupwallet(const JSONRPCRequest& request)
} }
UniValue keypoolrefill(const JSONRPCRequest& request) static UniValue keypoolrefill(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2474,7 +2474,7 @@ static void LockWallet(CWallet* pWallet)
pWallet->Lock(); pWallet->Lock();
} }
UniValue walletpassphrase(const JSONRPCRequest& request) static UniValue walletpassphrase(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2547,7 +2547,7 @@ UniValue walletpassphrase(const JSONRPCRequest& request)
} }
UniValue walletpassphrasechange(const JSONRPCRequest& request) static UniValue walletpassphrasechange(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2596,7 +2596,7 @@ UniValue walletpassphrasechange(const JSONRPCRequest& request)
} }
UniValue walletlock(const JSONRPCRequest& request) static UniValue walletlock(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2634,7 +2634,7 @@ UniValue walletlock(const JSONRPCRequest& request)
} }
UniValue encryptwallet(const JSONRPCRequest& request) static UniValue encryptwallet(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2694,7 +2694,7 @@ UniValue encryptwallet(const JSONRPCRequest& request)
return "wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet. The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup."; return "wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet. The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup.";
} }
UniValue lockunspent(const JSONRPCRequest& request) static UniValue lockunspent(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2821,7 +2821,7 @@ UniValue lockunspent(const JSONRPCRequest& request)
return true; return true;
} }
UniValue listlockunspent(const JSONRPCRequest& request) static UniValue listlockunspent(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2872,7 +2872,7 @@ UniValue listlockunspent(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue settxfee(const JSONRPCRequest& request) static UniValue settxfee(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2901,7 +2901,7 @@ UniValue settxfee(const JSONRPCRequest& request)
return true; return true;
} }
UniValue getwalletinfo(const JSONRPCRequest& request) static UniValue getwalletinfo(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -2962,7 +2962,7 @@ UniValue getwalletinfo(const JSONRPCRequest& request)
return obj; return obj;
} }
UniValue listwallets(const JSONRPCRequest& request) static UniValue listwallets(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 0) if (request.fHelp || request.params.size() != 0)
throw std::runtime_error( throw std::runtime_error(
@ -2994,7 +2994,7 @@ UniValue listwallets(const JSONRPCRequest& request)
return obj; return obj;
} }
UniValue resendwallettransactions(const JSONRPCRequest& request) static UniValue resendwallettransactions(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -3029,7 +3029,7 @@ UniValue resendwallettransactions(const JSONRPCRequest& request)
return result; return result;
} }
UniValue listunspent(const JSONRPCRequest& request) static UniValue listunspent(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -3200,7 +3200,7 @@ UniValue listunspent(const JSONRPCRequest& request)
return results; return results;
} }
UniValue fundrawtransaction(const JSONRPCRequest& request) static UniValue fundrawtransaction(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -3469,7 +3469,7 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
return SignTransaction(mtx, request.params[1], pwallet, false, request.params[2]); return SignTransaction(mtx, request.params[1], pwallet, false, request.params[2]);
} }
UniValue bumpfee(const JSONRPCRequest& request) static UniValue bumpfee(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
@ -3848,7 +3848,7 @@ public:
UniValue operator()(const WitnessUnknown& id) const { return UniValue(UniValue::VOBJ); } UniValue operator()(const WitnessUnknown& id) const { return UniValue(UniValue::VOBJ); }
}; };
UniValue DescribeWalletAddress(CWallet* pwallet, const CTxDestination& dest) static UniValue DescribeWalletAddress(CWallet* pwallet, const CTxDestination& dest)
{ {
UniValue ret(UniValue::VOBJ); UniValue ret(UniValue::VOBJ);
UniValue detail = DescribeAddress(dest); UniValue detail = DescribeAddress(dest);
@ -3984,7 +3984,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue getaddressesbylabel(const JSONRPCRequest& request) static UniValue getaddressesbylabel(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
@ -4027,7 +4027,7 @@ UniValue getaddressesbylabel(const JSONRPCRequest& request)
return ret; return ret;
} }
UniValue listlabels(const JSONRPCRequest& request) static UniValue listlabels(const JSONRPCRequest& request)
{ {
CWallet * const pwallet = GetWalletForJSONRPCRequest(request); CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {

View file

@ -246,7 +246,7 @@ public:
} }
}; };
bool static bool
ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
CWalletScanState &wss, std::string& strType, std::string& strErr) CWalletScanState &wss, std::string& strType, std::string& strErr)
{ {