aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPatick Strateman <[email protected]>2015-11-17 17:01:43 -0800
committerPatick Strateman <[email protected]>2015-11-20 16:07:12 -0800
commitd8aaa51bec7d9e96eab78b88f494efb937a93bfb (patch)
tree4176c4fb83c9f873907fa0f10a1245ce9a511829 /src/main.cpp
parentFix relay mechanism for whitelisted peers under blocks only mode. (diff)
downloaddiscoin-d8aaa51bec7d9e96eab78b88f494efb937a93bfb.tar.xz
discoin-d8aaa51bec7d9e96eab78b88f494efb937a93bfb.zip
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 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<uint256> vWorkQueue;
vector<uint256> vEraseQueue;
CTransaction tx;