From d8aaa51bec7d9e96eab78b88f494efb937a93bfb Mon Sep 17 00:00:00 2001 From: Patick Strateman Date: Tue, 17 Nov 2015 17:01:43 -0800 Subject: [PATCH] Bail early in processing transactions in blocks only mode. Previously unsolicited transactions would be processed as normal. --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index c7e67a1d7..243a64759 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4384,6 +4384,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, else if (strCommand == "tx") { + // Stop processing the transaction early if + // We are in blocks only mode and peer is either not whitelisted or whitelistalwaysrelay is off + if (GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && (!pfrom->fWhitelisted || !GetBoolArg("-whitelistalwaysrelay", DEFAULT_WHITELISTALWAYSRELAY))) + { + LogPrint("net", "peer sent transaction in violation of protocol peer=%d\n", pfrom->id); + return true; + } + vector vWorkQueue; vector vEraseQueue; CTransaction tx;