Skip to content

Commit 3a96497

Browse files
committed
Add whitelistalwaysrelay option
1 parent 420fa81 commit 3a96497

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/init.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,16 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
816816
}
817817
#endif
818818
}
819+
820+
// disable walletbroadcast in blocksonly mode
821+
if (GetBoolArg("-blocksonly", false)) {
822+
if (SoftSetBoolArg("-whitelistalwaysrelay", false))
823+
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -whitelistalwaysrelay=0\n", __func__);
824+
#ifdef ENABLE_WALLET
825+
if (SoftSetBoolArg("-walletbroadcast", false))
826+
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
827+
#endif
828+
}
819829

820830
// Make sure enough file descriptors are available
821831
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1);

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4465,7 +4465,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
44654465
assert(recentRejects);
44664466
recentRejects->insert(tx.GetHash());
44674467

4468-
if (pfrom->fWhitelisted) {
4468+
if (pfrom->fWhitelisted && GetBoolArg("-whitelistalwaysrelay", DEFAULT_WHITELISTALWAYSRELAY)) {
44694469
// Always relay transactions received from whitelisted peers, even
44704470
// if they were rejected from the mempool, allowing the node to
44714471
// function as a gateway for nodes hidden behind it.

src/main.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ struct CNodeStateStats;
4141

4242
/** Default for accepting alerts from the P2P network. */
4343
static const bool DEFAULT_ALERTS = true;
44+
/** Default for DEFAULT_WHITELISTALWAYSRELAY. */
45+
static const bool DEFAULT_WHITELISTALWAYSRELAY = true;
4446
/** Default for -minrelaytxfee, minimum relay fee for transactions */
4547
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
4648
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */

0 commit comments

Comments
 (0)