aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatick Strateman <patrick.strateman@gmail.com>2015-11-14 04:46:23 -0800
committerPatick Strateman <patrick.strateman@gmail.com>2015-11-14 04:52:21 -0800
commit3a964973fe9335f31c418b00e762ea04c3d3f088 (patch)
tree41c38ed9f028280f3802c4ac863f2278eb34b2ff /src
parent420fa8143a81f60fea79ee05df553e89378f1054 (diff)
downloadbitcoin-3a964973fe9335f31c418b00e762ea04c3d3f088.tar.xz
Add whitelistalwaysrelay option
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp10
-rw-r--r--src/main.cpp2
-rw-r--r--src/main.h2
3 files changed, 13 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index f2001236a2..8e5c318352 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -816,6 +816,16 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
#endif
}
+
+ // disable walletbroadcast in blocksonly mode
+ if (GetBoolArg("-blocksonly", false)) {
+ if (SoftSetBoolArg("-whitelistalwaysrelay", false))
+ LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -whitelistalwaysrelay=0\n", __func__);
+#ifdef ENABLE_WALLET
+ if (SoftSetBoolArg("-walletbroadcast", false))
+ LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
+#endif
+ }
// Make sure enough file descriptors are available
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1);
diff --git a/src/main.cpp b/src/main.cpp
index b35a032733..9842acb4b3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4465,7 +4465,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
assert(recentRejects);
recentRejects->insert(tx.GetHash());
- if (pfrom->fWhitelisted) {
+ if (pfrom->fWhitelisted && GetBoolArg("-whitelistalwaysrelay", DEFAULT_WHITELISTALWAYSRELAY)) {
// Always relay transactions received from whitelisted peers, even
// if they were rejected from the mempool, allowing the node to
// function as a gateway for nodes hidden behind it.
diff --git a/src/main.h b/src/main.h
index 5fb5534860..c304b311e4 100644
--- a/src/main.h
+++ b/src/main.h
@@ -41,6 +41,8 @@ struct CNodeStateStats;
/** Default for accepting alerts from the P2P network. */
static const bool DEFAULT_ALERTS = true;
+/** Default for DEFAULT_WHITELISTALWAYSRELAY. */
+static const bool DEFAULT_WHITELISTALWAYSRELAY = true;
/** Default for -minrelaytxfee, minimum relay fee for transactions */
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */