aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorR E Broadley <rebroad+github@gmail.com>2016-09-13 09:10:22 +0700
committerR E Broadley <rebroad+github@gmail.com>2016-09-13 09:10:22 +0700
commit1f951c67a4d1e94895783d2c6b9bd235b2bf66b8 (patch)
tree25065e51684468cbd8f8a0ad713378e1ee60b114 /src/main.cpp
parent2a0836f6d5e7c1d7e97bedb0e0ea33dcaf981f77 (diff)
Allow filterclear messages for enabling TX relay only.
An example of where this might be useful is allowing a node to connect blocksonly during IBD but then becoming a full-node once caught up with the latest block. This might also even want to be the default behaviour since during IBD most TXs appear to be orphans, and are routinely dropped (for example when a node disconnects). Therefore, this can waste a lot of bandwidth. Additionally, another pull could be written to stop relaying of TXs to nodes that are clearly far behind the latest block and are running a node that doesn't store many orphan TXs, such as recent versions of Bitcoin Core.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index cb6e942272..6e3f9daf45 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4941,8 +4941,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
if (!(pfrom->GetLocalServices() & NODE_BLOOM) &&
(strCommand == NetMsgType::FILTERLOAD ||
- strCommand == NetMsgType::FILTERADD ||
- strCommand == NetMsgType::FILTERCLEAR))
+ strCommand == NetMsgType::FILTERADD))
{
if (pfrom->nVersion >= NO_BLOOM_VERSION) {
LOCK(cs_main);
@@ -6128,8 +6127,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
else if (strCommand == NetMsgType::FILTERCLEAR)
{
LOCK(pfrom->cs_filter);
- delete pfrom->pfilter;
- pfrom->pfilter = new CBloomFilter();
+ if (pfrom->GetLocalServices() & NODE_BLOOM) {
+ delete pfrom->pfilter;
+ pfrom->pfilter = new CBloomFilter();
+ }
pfrom->fRelayTxes = true;
}