diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -183,7 +183,7 @@
std::string body;
};
-const char *http_errorstring(int code) {
+static const char *http_errorstring(int code) {
switch (code) {
#if LIBEVENT_VERSION_NUMBER >= 0x02010300
case EVREQ_HTTP_TIMEOUT:
@@ -472,7 +472,7 @@
return reply;
}
-int CommandLineRPC(int argc, char *argv[]) {
+static int CommandLineRPC(int argc, char *argv[]) {
std::string strPrint;
int nRet = 0;
try {
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -44,7 +44,7 @@
* Files
at the top of the page to start navigating the code.
*/
-void WaitForShutdown() {
+static void WaitForShutdown() {
while (!ShutdownRequested()) {
MilliSleep(200);
}
@@ -55,7 +55,7 @@
//
// Start
//
-bool AppInit(int argc, char *argv[]) {
+static bool AppInit(int argc, char *argv[]) {
// FIXME: Ideally, we'd like to build the config here, but that's currently
// not possible as the whole application has too many global state. However,
// this is a first step.
diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -312,11 +312,11 @@
}
#endif
-void OnRPCStarted() {
+static void OnRPCStarted() {
uiInterface.NotifyBlockTip.connect(&RPCNotifyBlockChange);
}
-void OnRPCStopped() {
+static void OnRPCStopped() {
uiInterface.NotifyBlockTip.disconnect(&RPCNotifyBlockChange);
RPCNotifyBlockChange(false, nullptr);
g_best_block_cv.notify_all();
@@ -1052,7 +1052,7 @@
// 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 works correctly.
-void CleanupBlockRevFiles() {
+static void CleanupBlockRevFiles() {
std::map mapBlockFiles;
// Glob all blk?????.dat and rev?????.dat files from the blocks directory.
@@ -1089,7 +1089,8 @@
}
}
-void ThreadImport(const Config &config, std::vector vImportFiles) {
+static void ThreadImport(const Config &config,
+ std::vector vImportFiles) {
RenameThread("bitcoin-loadblk");
{
@@ -1175,7 +1176,7 @@
* Ensure that Bitcoin is running in a usable environment with all
* necessary library support.
*/
-bool InitSanityCheck(void) {
+static bool InitSanityCheck(void) {
if (!ECC_InitSanityCheck()) {
InitError(
"Elliptic curve cryptography sanity check failure. Aborting.");
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -1386,8 +1386,8 @@
return txid.GetHex();
}
-UniValue testmempoolaccept(const Config &config,
- const JSONRPCRequest &request) {
+static UniValue testmempoolaccept(const Config &config,
+ const JSONRPCRequest &request) {
if (request.fHelp || request.params.size() < 1 ||
request.params.size() > 2) {
throw std::runtime_error(
diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp
--- a/src/support/lockedpool.cpp
+++ b/src/support/lockedpool.cpp
@@ -118,7 +118,7 @@
}
#ifdef ARENA_DEBUG
-void printchunk(char *base, size_t sz, bool used) {
+static void printchunk(char *base, size_t sz, bool used) {
std::cout << "0x" << std::hex << std::setw(16) << std::setfill('0') << base
<< " 0x" << std::hex << std::setw(16) << std::setfill('0') << sz
<< " 0x" << used << std::endl;
diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp
--- a/src/test/DoS_tests.cpp
+++ b/src/test/DoS_tests.cpp
@@ -33,7 +33,7 @@
};
extern std::map mapOrphanTransactions;
-CService ip(uint32_t i) {
+static CService ip(uint32_t i) {
struct in_addr s;
s.s_addr = i;
return CService(CNetAddr(s), Params().GetDefaultPort());
@@ -97,9 +97,9 @@
peerLogic->FinalizeNode(config, dummyNode1.GetId(), dummy);
}
-void AddRandomOutboundPeer(const Config &config,
- std::vector> &vNodes,
- PeerLogicValidation &peerLogic) {
+static void AddRandomOutboundPeer(const Config &config,
+ std::vector> &vNodes,
+ PeerLogicValidation &peerLogic) {
CAddress addr(ip(GetRandInt(0xffffffff)), NODE_NONE);
vNodes.emplace_back(new CNode(id++, ServiceFlags(NODE_NETWORK), 0,
INVALID_SOCKET, addr, 0, 0, CAddress(), "",
@@ -310,7 +310,7 @@
peerLogic->FinalizeNode(config, dummyNode.GetId(), dummy);
}
-CTransactionRef RandomOrphan() {
+static CTransactionRef RandomOrphan() {
std::map::iterator it;
LOCK(cs_main);
it = mapOrphanTransactions.lower_bound(InsecureRand256());
diff --git a/src/test/arith_uint256_tests.cpp b/src/test/arith_uint256_tests.cpp
--- a/src/test/arith_uint256_tests.cpp
+++ b/src/test/arith_uint256_tests.cpp
@@ -21,7 +21,8 @@
BOOST_FIXTURE_TEST_SUITE(arith_uint256_tests, BasicTestingSetup)
/// Convert vector to arith_uint256, via uint256 blob
-inline arith_uint256 arith_uint256V(const std::vector &vch) {
+static inline arith_uint256
+arith_uint256V(const std::vector &vch) {
return UintToArith256(uint256(vch));
}
@@ -64,7 +65,7 @@
arith_uint256V(std::vector(MaxArray, MaxArray + 32));
const arith_uint256 HalfL = (OneL << 255);
-std::string ArrayToString(const uint8_t A[], unsigned int width) {
+static std::string ArrayToString(const unsigned char A[], unsigned int width) {
std::stringstream Stream;
Stream << std::hex;
for (unsigned int i = 0; i < width; ++i) {
@@ -138,8 +139,9 @@
BOOST_CHECK(tmpL == ~MaxL);
}
-void shiftArrayRight(uint8_t *to, const uint8_t *from, unsigned int arrayLength,
- unsigned int bitsToShift) {
+static void shiftArrayRight(uint8_t *to, const uint8_t *from,
+ unsigned int arrayLength,
+ unsigned int bitsToShift) {
for (unsigned int T = 0; T < arrayLength; ++T) {
unsigned int F = (T + bitsToShift / 8);
if (F < arrayLength) {
@@ -153,8 +155,8 @@
}
}
-void shiftArrayLeft(uint8_t *to, const uint8_t *from, unsigned int arrayLength,
- unsigned int bitsToShift) {
+static void shiftArrayLeft(uint8_t *to, const uint8_t *from,
+ unsigned int arrayLength, unsigned int bitsToShift) {
for (unsigned int T = 0; T < arrayLength; ++T) {
if (T >= bitsToShift / 8) {
unsigned int F = T - bitsToShift / 8;
@@ -427,7 +429,7 @@
BOOST_CHECK_THROW(R2L / ZeroL, uint_error);
}
-bool almostEqual(double d1, double d2) {
+static bool almostEqual(double d1, double d2) {
return fabs(d1 - d2) <=
4 * fabs(d1) * std::numeric_limits::epsilon();
}
diff --git a/src/test/bip32_tests.cpp b/src/test/bip32_tests.cpp
--- a/src/test/bip32_tests.cpp
+++ b/src/test/bip32_tests.cpp
@@ -94,7 +94,7 @@
0);
// clang-format on
-void RunTest(const TestVector &test) {
+static void RunTest(const TestVector &test) {
std::vector seed = ParseHex(test.strHexMaster);
CExtKey key;
CExtPubKey pubkey;
diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp
--- a/src/test/coins_tests.cpp
+++ b/src/test/coins_tests.cpp
@@ -580,7 +580,8 @@
}
}
-size_t InsertCoinMapEntry(CCoinsMap &map, const Amount value, char flags) {
+static size_t InsertCoinMapEntry(CCoinsMap &map, const Amount value,
+ char flags) {
if (value == ABSENT) {
assert(flags == NO_ENTRY);
return 0;
@@ -631,9 +632,9 @@
CCoinsViewCacheTest cache{&base};
};
-void CheckAccessCoin(const Amount base_value, const Amount cache_value,
- const Amount expected_value, char cache_flags,
- char expected_flags) {
+static void CheckAccessCoin(const Amount base_value, const Amount cache_value,
+ const Amount expected_value, char cache_flags,
+ char expected_flags) {
SingleEntryCacheTest test(base_value, cache_value, cache_flags);
test.cache.AccessCoin(OUTPOINT);
test.cache.SelfTest();
@@ -682,9 +683,9 @@
CheckAccessCoin(VALUE1, VALUE2, VALUE2, DIRTY | FRESH, DIRTY | FRESH);
}
-void CheckSpendCoin(Amount base_value, Amount cache_value,
- Amount expected_value, char cache_flags,
- char expected_flags) {
+static void CheckSpendCoin(Amount base_value, Amount cache_value,
+ Amount expected_value, char cache_flags,
+ char expected_flags) {
SingleEntryCacheTest test(base_value, cache_value, cache_flags);
test.cache.SpendCoin(OUTPOINT);
test.cache.SelfTest();
@@ -734,9 +735,10 @@
CheckSpendCoin(VALUE1, VALUE2, ABSENT, DIRTY | FRESH, NO_ENTRY);
}
-void CheckAddCoinBase(Amount base_value, Amount cache_value,
- Amount modify_value, Amount expected_value,
- char cache_flags, char expected_flags, bool coinbase) {
+static void CheckAddCoinBase(Amount base_value, Amount cache_value,
+ Amount modify_value, Amount expected_value,
+ char cache_flags, char expected_flags,
+ bool coinbase) {
SingleEntryCacheTest test(base_value, cache_value, cache_flags);
Amount result_value;
@@ -762,7 +764,7 @@
// This wrapper lets the coin_add test below be shorter and less repetitive,
// while still verifying that the CoinsViewCache::AddCoin implementation ignores
// base values.
-template void CheckAddCoin(Args &&... args) {
+template static void CheckAddCoin(Args &&... args) {
for (Amount base_value : {ABSENT, PRUNED, VALUE1}) {
CheckAddCoinBase(base_value, std::forward(args)...);
}
diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp
--- a/src/test/crypto_tests.cpp
+++ b/src/test/crypto_tests.cpp
@@ -26,7 +26,7 @@
BOOST_FIXTURE_TEST_SUITE(crypto_tests, BasicTestingSetup)
template
-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;
BOOST_CHECK(out.size() == h.OUTPUT_SIZE);
hash.resize(out.size());
@@ -58,35 +58,35 @@
}
}
-void TestSHA1(const std::string &in, const std::string &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) {
+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) {
+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) {
+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 key = ParseHex(hexkey);
TestVector(CHMAC_SHA256(&key[0], 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 key = ParseHex(hexkey);
TestVector(CHMAC_SHA512(&key[0], 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 key = ParseHex(hexkey);
std::vector in = ParseHex(hexin);
std::vector correctout = ParseHex(hexout);
@@ -105,8 +105,8 @@
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 key = ParseHex(hexkey);
std::vector in = ParseHex(hexin);
std::vector correctout = ParseHex(hexout);
@@ -124,9 +124,9 @@
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 key = ParseHex(hexkey);
std::vector iv = ParseHex(hexiv);
std::vector in = ParseHex(hexin);
@@ -169,9 +169,9 @@
}
}
-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 key = ParseHex(hexkey);
std::vector iv = ParseHex(hexiv);
std::vector in = ParseHex(hexin);
@@ -214,8 +214,8 @@
}
}
-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 key = ParseHex(hexkey);
ChaCha20 rng(key.data(), key.size());
rng.SetIV(nonce);
@@ -227,7 +227,7 @@
BOOST_CHECK(out == outres);
}
-std::string LongTestString(void) {
+static std::string LongTestString(void) {
std::string ret;
for (int i = 0; i < 200000; i++) {
ret += uint8_t(i);
diff --git a/src/test/cuckoocache_tests.cpp b/src/test/cuckoocache_tests.cpp
--- a/src/test/cuckoocache_tests.cpp
+++ b/src/test/cuckoocache_tests.cpp
@@ -31,7 +31,7 @@
/**
* 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();
for (uint8_t j = 0; j < 8; ++j) {
*(ptr++) = local_rand_ctx.rand32();
@@ -63,7 +63,8 @@
* This helper returns the hit rate when megabytes*load worth of entries are
* inserted into a megabytes sized cache
*/
-template double test_cache(size_t megabytes, double load) {
+template
+static double test_cache(size_t megabytes, double load) {
local_rand_ctx = FastRandomContext(true);
std::vector hashes;
Cache set{};
@@ -113,7 +114,7 @@
* how you measure around load 1.0 as after load 1.0 your normalized hit rate
* 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);
}
@@ -135,7 +136,7 @@
/** This helper checks that erased elements are preferentially inserted onto and
* that the hit rate of "fresher" keys is reasonable*/
-template void test_cache_erase(size_t megabytes) {
+template static void test_cache_erase(size_t megabytes) {
double load = 1;
local_rand_ctx = FastRandomContext(true);
std::vector hashes;
@@ -204,7 +205,8 @@
megabytes);
}
-template void test_cache_erase_parallel(size_t megabytes) {
+template
+static void test_cache_erase_parallel(size_t megabytes) {
double load = 1;
local_rand_ctx = FastRandomContext(true);
std::vector hashes;
@@ -297,7 +299,7 @@
CuckooCache::cache>(megabytes);
}
-template void test_cache_generations() {
+template static void test_cache_generations() {
// 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
// 99.9% are less than 1% of the time.
diff --git a/src/test/dbwrapper_tests.cpp b/src/test/dbwrapper_tests.cpp
--- a/src/test/dbwrapper_tests.cpp
+++ b/src/test/dbwrapper_tests.cpp
@@ -12,7 +12,7 @@
#include
// Test if a string consists entirely of null characters
-bool is_null_key(const std::vector &key) {
+static bool is_null_key(const std::vector &key) {
bool isnull = true;
for (unsigned int i = 0; i < key.size(); i++)
diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp
--- a/src/test/miner_tests.cpp
+++ b/src/test/miner_tests.cpp
@@ -66,14 +66,14 @@
{2, 0xbbbeb305}, {2, 0xfe1c810a},
};
-CBlockIndex CreateBlockIndex(int nHeight) {
+static CBlockIndex CreateBlockIndex(int nHeight) {
CBlockIndex index;
index.nHeight = nHeight;
index.pprev = chainActive.Tip();
return index;
}
-bool TestSequenceLocks(const CTransaction &tx, int flags) {
+static bool TestSequenceLocks(const CTransaction &tx, int flags) {
LOCK(g_mempool.cs);
return CheckSequenceLocks(tx, flags);
}
@@ -82,8 +82,8 @@
// Implemented as an additional function, rather than a separate test case, to
// allow reusing the blockchain created in CreateNewBlock_validity.
// Note that this test assumes blockprioritypercentage is 0.
-void TestPackageSelection(Config &config, CScript scriptPubKey,
- std::vector &txFirst) {
+static void TestPackageSelection(Config &config, CScript scriptPubKey,
+ std::vector &txFirst) {
// Test the ancestor feerate transaction selection.
TestMemPoolEntryHelper entry;
diff --git a/src/test/multisig_tests.cpp b/src/test/multisig_tests.cpp
--- a/src/test/multisig_tests.cpp
+++ b/src/test/multisig_tests.cpp
@@ -20,9 +20,9 @@
BOOST_FIXTURE_TEST_SUITE(multisig_tests, BasicTestingSetup)
-CScript sign_multisig(const CScript &scriptPubKey,
- const std::vector &keys,
- const CMutableTransaction &tx, int whichIn) {
+static CScript sign_multisig(const CScript &scriptPubKey,
+ const std::vector &keys,
+ const CMutableTransaction &tx, int whichIn) {
uint256 hash = SignatureHash(scriptPubKey, CTransaction(tx), whichIn,
SigHashType(), Amount::zero());
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp
--- a/src/test/net_tests.cpp
+++ b/src/test/net_tests.cpp
@@ -72,7 +72,7 @@
uint64_t nMaxBlockSize;
};
-CDataStream AddrmanToStream(CAddrManSerializationMock &_addrman) {
+static CDataStream AddrmanToStream(CAddrManSerializationMock &_addrman) {
CDataStream ssPeersIn(SER_DISK, CLIENT_VERSION);
ssPeersIn << FLATDATA(Params().DiskMagic());
ssPeersIn << _addrman;
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp
--- a/src/test/script_tests.cpp
+++ b/src/test/script_tests.cpp
@@ -93,7 +93,7 @@
{SCRIPT_ERR_MOD_BY_ZERO, "MOD_BY_ZERO"},
};
-const char *FormatScriptError(ScriptError_t err) {
+static const char *FormatScriptError(ScriptError_t err) {
for (size_t i = 0; i < ARRAYLEN(script_errors); ++i) {
if (script_errors[i].err == err) {
return script_errors[i].name;
@@ -105,7 +105,7 @@
return "";
}
-ScriptError_t ParseScriptError(const std::string &name) {
+static ScriptError_t ParseScriptError(const std::string &name) {
for (size_t i = 0; i < ARRAYLEN(script_errors); ++i) {
if (script_errors[i].name == name) {
return script_errors[i].err;
@@ -1883,9 +1883,9 @@
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
}
-CScript sign_multisig(const CScript &scriptPubKey,
- const std::vector &keys,
- const CTransaction &transaction) {
+static CScript sign_multisig(const CScript &scriptPubKey,
+ const std::vector &keys,
+ const CTransaction &transaction) {
uint256 hash = SignatureHash(scriptPubKey, transaction, 0, SigHashType(),
Amount::zero());
@@ -1907,8 +1907,8 @@
return result;
}
-CScript sign_multisig(const CScript &scriptPubKey, const CKey &key,
- const CTransaction &transaction) {
+static CScript sign_multisig(const CScript &scriptPubKey, const CKey &key,
+ const CTransaction &transaction) {
std::vector keys;
keys.push_back(key);
return sign_multisig(scriptPubKey, keys, transaction);
diff --git a/src/test/sigopcount_tests.cpp b/src/test/sigopcount_tests.cpp
--- a/src/test/sigopcount_tests.cpp
+++ b/src/test/sigopcount_tests.cpp
@@ -114,8 +114,8 @@
* Verifies script execution of the zeroth scriptPubKey of tx output and zeroth
* scriptSig 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;
CTransaction inputi(input);
bool ret = VerifyScript(
@@ -131,9 +131,9 @@
* such that spendingTx spends output zero of creationTx. Also inserts
* creationTx's output into the coins view.
*/
-void BuildTxs(CMutableTransaction &spendingTx, CCoinsViewCache &coins,
- CMutableTransaction &creationTx, const CScript &scriptPubKey,
- const CScript &scriptSig) {
+static void BuildTxs(CMutableTransaction &spendingTx, CCoinsViewCache &coins,
+ CMutableTransaction &creationTx,
+ const CScript &scriptPubKey, const CScript &scriptSig) {
creationTx.nVersion = 1;
creationTx.vin.resize(1);
creationTx.vin[0].prevout = COutPoint();
diff --git a/src/test/test_bitcoin_fuzzy.cpp b/src/test/test_bitcoin_fuzzy.cpp
--- a/src/test/test_bitcoin_fuzzy.cpp
+++ b/src/test/test_bitcoin_fuzzy.cpp
@@ -46,7 +46,7 @@
TEST_ID_END
};
-bool read_stdin(std::vector &data) {
+static bool read_stdin(std::vector &data) {
char buffer[1024];
ssize_t length = 0;
while ((length = read(STDIN_FILENO, buffer, 1024)) > 0) {
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -335,9 +335,11 @@
(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;
outputm.nVersion = 1;
outputm.vin.resize(1);
@@ -373,8 +375,9 @@
BOOST_CHECK(input.vout[0] == inputm.vout[0]);
}
-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;
CTransaction inputi(input);
bool ret = VerifyScript(
@@ -399,7 +402,7 @@
return result;
}
-void ReplaceRedeemScript(CScript &script, const CScript &redeemScript) {
+static void ReplaceRedeemScript(CScript &script, const CScript &redeemScript) {
std::vector stack;
EvalScript(stack, script, SCRIPT_VERIFY_STRICTENC, BaseSignatureChecker());
BOOST_CHECK(stack.size() > 0);
diff --git a/src/test/txvalidationcache_tests.cpp b/src/test/txvalidationcache_tests.cpp
--- a/src/test/txvalidationcache_tests.cpp
+++ b/src/test/txvalidationcache_tests.cpp
@@ -102,9 +102,10 @@
// should fail.
// Capture this interaction with the upgraded_nop argument: set it when
// evaluating any script flag that is implemented as an upgraded NOP code.
-void ValidateCheckInputsForAllFlags(const CTransaction &tx,
- uint32_t failing_flags, bool add_to_cache,
- bool upgraded_nop) {
+static void ValidateCheckInputsForAllFlags(const CTransaction &tx,
+ uint32_t failing_flags,
+ bool add_to_cache,
+ bool upgraded_nop) {
PrecomputedTransactionData txdata(tx);
// If we add many more flags, this loop can get too expensive, but we can
// rewrite in the future to randomly pick a set of flags to evaluate.
diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp
--- a/src/test/uint256_tests.cpp
+++ b/src/test/uint256_tests.cpp
@@ -53,7 +53,7 @@
const uint256 MaxL = uint256(std::vector(MaxArray, MaxArray + 32));
const uint160 MaxS = uint160(std::vector(MaxArray, MaxArray + 20));
-std::string ArrayToString(const uint8_t A[], unsigned int width) {
+static std::string ArrayToString(const unsigned char A[], unsigned int width) {
std::stringstream Stream;
Stream << std::hex;
for (unsigned int i = 0; i < width; ++i) {
diff --git a/src/validation.cpp b/src/validation.cpp
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1341,8 +1341,8 @@
}
/** 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);
LogPrintf("*** %s\n", strMessage);
uiInterface.ThreadSafeMessageBox(
@@ -1354,8 +1354,8 @@
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);
return state.Error(strMessage);
}
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -54,7 +54,7 @@
return ret.str();
}
-std::string DecodeDumpString(const std::string &str) {
+static std::string DecodeDumpString(const std::string &str) {
std::stringstream ret;
for (unsigned int pos = 0; pos < str.length(); pos++) {
uint8_t c = str[pos];
@@ -207,10 +207,10 @@
return true;
}
-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 ImportAddress(CWallet *, const CTxDestination &dest,
+ const std::string &strLabel);
+static void ImportScript(CWallet *const pwallet, const CScript &script,
+ const std::string &strLabel, bool isRedeemScript) {
if (!isRedeemScript && ::IsMine(*pwallet, script) == ISMINE_SPENDABLE) {
throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the "
"private key for this address or "
@@ -238,8 +238,8 @@
}
}
-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);
ImportScript(pwallet, script, strLabel, false);
// add to address book or update label
@@ -911,8 +911,8 @@
return reply;
}
-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 {
bool success = false;
@@ -1280,7 +1280,7 @@
}
}
-int64_t GetImportTimestamp(const UniValue &data, int64_t now) {
+static int64_t GetImportTimestamp(const UniValue &data, int64_t now) {
if (data.exists("timestamp")) {
const UniValue ×tamp = data["timestamp"];
if (timestamp.isNum()) {
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -107,7 +107,7 @@
}
}
-void WalletTxToJSON(const CWalletTx &wtx, UniValue &entry) {
+static void WalletTxToJSON(const CWalletTx &wtx, UniValue &entry) {
int confirms = wtx.GetDepthInMainChain();
entry.pushKV("confirmations", confirms);
if (wtx.IsCoinBase()) {
@@ -136,7 +136,7 @@
}
}
-std::string LabelFromValue(const UniValue &value) {
+static std::string LabelFromValue(const UniValue &value) {
std::string label = value.get_str();
if (label == "*") {
throw JSONRPCError(RPC_WALLET_INVALID_LABEL_NAME, "Invalid label name");
@@ -221,7 +221,8 @@
return dest;
}
-UniValue getlabeladdress(const Config &config, const JSONRPCRequest &request) {
+static UniValue getlabeladdress(const Config &config,
+ const JSONRPCRequest &request) {
CWallet *const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
@@ -309,7 +310,7 @@
return EncodeDestination(dest);
}
-UniValue setlabel(const Config &config, const JSONRPCRequest &request) {
+static UniValue setlabel(const Config &config, const JSONRPCRequest &request) {
CWallet *const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
@@ -821,8 +822,8 @@
return ValueFromAmount(nAmount);
}
-UniValue getreceivedbylabel(const Config &config,
- const JSONRPCRequest &request) {
+static UniValue getreceivedbylabel(const Config &config,
+ const JSONRPCRequest &request) {
CWallet *const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
@@ -1366,8 +1367,8 @@
return tx->GetId().GetHex();
}
-UniValue addmultisigaddress(const Config &config,
- const JSONRPCRequest &request) {
+static UniValue addmultisigaddress(const Config &config,
+ const JSONRPCRequest &request) {
CWallet *const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
@@ -1479,8 +1480,8 @@
}
};
-UniValue ListReceived(const Config &config, CWallet *const pwallet,
- const UniValue ¶ms, bool by_label) {
+static UniValue ListReceived(const Config &config, CWallet *const pwallet,
+ const UniValue ¶ms, bool by_label) {
// Minimum confirmations
int nMinDepth = 1;
if (!params[0].isNull()) {
@@ -1697,8 +1698,8 @@
return ListReceived(config, pwallet, request.params, false);
}
-UniValue listreceivedbylabel(const Config &config,
- const JSONRPCRequest &request) {
+static UniValue listreceivedbylabel(const Config &config,
+ const JSONRPCRequest &request) {
CWallet *const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
@@ -1765,9 +1766,10 @@
* @param ret The UniValue into which the result is stored.
* @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) {
Amount nFee;
std::string strSentAccount;
std::list listReceived;
@@ -1845,8 +1847,8 @@
}
}
-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("*"));
if (fAllAccounts || acentry.strAccount == strAccount) {
@@ -4084,7 +4086,8 @@
}
};
-UniValue DescribeWalletAddress(CWallet *pwallet, const CTxDestination &dest) {
+static UniValue DescribeWalletAddress(CWallet *pwallet,
+ const CTxDestination &dest) {
UniValue ret(UniValue::VOBJ);
UniValue detail = DescribeAddress(dest);
ret.pushKVs(detail);
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -266,9 +266,9 @@
}
};
-bool ReadKeyValue(CWallet *pwallet, CDataStream &ssKey, CDataStream &ssValue,
- CWalletScanState &wss, std::string &strType,
- std::string &strErr) {
+static bool ReadKeyValue(CWallet *pwallet, CDataStream &ssKey,
+ CDataStream &ssValue, CWalletScanState &wss,
+ std::string &strType, std::string &strErr) {
try {
// Unserialize
// Taking advantage of the fact that pair serialization is just the two