Skip to content

Commit 97c7da4

Browse files
laanwjcodablock
authored andcommitted
Merge bitcoin#7509: Common argument defaults for NODE_BLOOM stuff and -wallet
1fb91b3 Common argument defaults for NODE_BLOOM stuff and -wallet (Luke Dashjr)
1 parent ee5f8d2 commit 97c7da4

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/init.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ static const bool DEFAULT_REST_ENABLE = false;
102102
static const bool DEFAULT_DISABLE_SAFEMODE = false;
103103
static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false;
104104

105+
static const char * const DEFAULT_WALLET_DAT = "wallet.dat";
106+
105107
std::unique_ptr<CConnman> g_connman;
106108
std::unique_ptr<PeerLogicValidation> peerLogic;
107109

@@ -448,9 +450,9 @@ std::string HelpMessage(HelpMessageMode mode)
448450
strUsage += HelpMessageOpt("-onion=<ip:port>", strprintf(_("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)"), "-proxy"));
449451
strUsage += HelpMessageOpt("-onlynet=<net>", _("Only connect to nodes in network <net> (ipv4, ipv6 or onion)"));
450452
strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), DEFAULT_PERMIT_BAREMULTISIG));
451-
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with bloom filters (default: %u)"), 1));
453+
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with bloom filters (default: %u)"), DEFAULT_PEERBLOOMFILTERS));
452454
if (showDebug)
453-
strUsage += HelpMessageOpt("-enforcenodebloom", strprintf("Enforce minimum protocol version to limit use of bloom filters (default: %u)", 0));
455+
strUsage += HelpMessageOpt("-enforcenodebloom", strprintf("Enforce minimum protocol version to limit use of bloom filters (default: %u)", DEFAULT_ENFORCENODEBLOOM));
454456
strUsage += HelpMessageOpt("-port=<port>", strprintf(_("Listen for connections on <port> (default: %u or testnet: %u)"), Params(CBaseChainParams::MAIN).GetDefaultPort(), Params(CBaseChainParams::TESTNET).GetDefaultPort()));
455457
strUsage += HelpMessageOpt("-proxy=<ip:port>", _("Connect through SOCKS5 proxy"));
456458
strUsage += HelpMessageOpt("-proxyrandomize", strprintf(_("Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)"), DEFAULT_PROXYRANDOMIZE));
@@ -492,7 +494,7 @@ std::string HelpMessage(HelpMessageMode mode)
492494
strUsage += HelpMessageOpt("-mnemonicpassphrase", _("User defined mnemonic passphrase for HD wallet (bip39). Only has effect during wallet creation/first start (default: empty string)"));
493495
strUsage += HelpMessageOpt("-hdseed", _("User defined seed for HD wallet (should be in hex). Only has effect during wallet creation/first start (default: randomly generated)"));
494496
strUsage += HelpMessageOpt("-upgradewallet", _("Upgrade wallet to latest format on startup"));
495-
strUsage += HelpMessageOpt("-wallet=<file>", _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat"));
497+
strUsage += HelpMessageOpt("-wallet=<file>", _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), DEFAULT_WALLET_DAT));
496498
strUsage += HelpMessageOpt("-walletbroadcast", _("Make the wallet broadcast transactions") + " " + strprintf(_("(default: %u)"), DEFAULT_WALLETBROADCAST));
497499
strUsage += HelpMessageOpt("-walletnotify=<cmd>", _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)"));
498500
strUsage += HelpMessageOpt("-zapwallettxes=<mode>", _("Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup") +
@@ -1191,7 +1193,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
11911193
bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE);
11921194
fSendFreeTransactions = GetBoolArg("-sendfreetransactions", DEFAULT_SEND_FREE_TRANSACTIONS);
11931195

1194-
std::string strWalletFile = GetArg("-wallet", "wallet.dat");
1196+
std::string strWalletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
11951197
#endif // ENABLE_WALLET
11961198

11971199
fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
@@ -1206,7 +1208,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
12061208
ServiceFlags nLocalServices = NODE_NETWORK;
12071209
ServiceFlags nRelevantServices = NODE_NETWORK;
12081210

1209-
if (GetBoolArg("-peerbloomfilters", true))
1211+
if (GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS))
12101212
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);
12111213

12121214
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
10961096
LOCK(cs_main);
10971097
Misbehaving(pfrom->GetId(), 100);
10981098
return false;
1099-
} else if (GetBoolArg("-enforcenodebloom", false)) {
1099+
} else if (GetBoolArg("-enforcenodebloom", DEFAULT_ENFORCENODEBLOOM)) {
11001100
pfrom->fDisconnect = true;
11011101
return false;
11021102
}

src/validation.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ static const bool DEFAULT_ENABLE_REPLACEMENT = false;
136136
/** Maximum number of headers to announce when relaying blocks with headers message.*/
137137
static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8;
138138

139+
static const bool DEFAULT_PEERBLOOMFILTERS = true;
140+
static const bool DEFAULT_ENFORCENODEBLOOM = false;
141+
139142
struct BlockHasher
140143
{
141144
size_t operator()(const uint256& hash) const { return hash.GetCheapHash(); }

0 commit comments

Comments
 (0)