Skip to content

Commit d8aaa51

Browse files
committed
Bail early in processing transactions in blocks only mode.
Previously unsolicited transactions would be processed as normal.
1 parent 3587f6a commit d8aaa51

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4384,6 +4384,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
43844384

43854385
else if (strCommand == "tx")
43864386
{
4387+
// Stop processing the transaction early if
4388+
// We are in blocks only mode and peer is either not whitelisted or whitelistalwaysrelay is off
4389+
if (GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && (!pfrom->fWhitelisted || !GetBoolArg("-whitelistalwaysrelay", DEFAULT_WHITELISTALWAYSRELAY)))
4390+
{
4391+
LogPrint("net", "peer sent transaction in violation of protocol peer=%d\n", pfrom->id);
4392+
return true;
4393+
}
4394+
43874395
vector<uint256> vWorkQueue;
43884396
vector<uint256> vEraseQueue;
43894397
CTransaction tx;

0 commit comments

Comments
 (0)