aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPatick Strateman <patrick.strateman@gmail.com>2015-11-17 17:01:43 -0800
committerPatick Strateman <patrick.strateman@gmail.com>2015-11-20 16:07:12 -0800
commitd8aaa51bec7d9e96eab78b88f494efb937a93bfb (patch)
tree4176c4fb83c9f873907fa0f10a1245ce9a511829 /src/main.cpp
parent3587f6a0247d12b7d50b184b16248ccec3757ff0 (diff)
downloadbitcoin-d8aaa51bec7d9e96eab78b88f494efb937a93bfb.tar.xz
Bail early in processing transactions in blocks only mode.
Previously unsolicited transactions would be processed as normal.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c7e67a1d74..243a647597 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<uint256> vWorkQueue;
vector<uint256> vEraseQueue;
CTransaction tx;