fBlocksOnly has several issues:
- The name is confusing
- It is untested
Fix both.
fBlocksOnly has several issues:
Fix both.
Fun fact: This is covered by the fuzz tests, but obviously they don't check the logic level of the code. https://marcofalke.github.io/btc_cov/fuzz.coverage/src/net_processing.cpp.gcov.html
Functional coverage: https://marcofalke.github.io/btc_cov/total.coverage/src/net_processing.cpp.gcov.html
There are some other issues with this code, which will be fixed in follow-ups, because they change the P2P protocol.
The new name describes better what the bool does and also limits the confusion of the three different concepts:
* fBlocksOnly (This bool to skip tx invs)
* -blocksonly (A setting to ignore incoming txs)
* block-relay-only (A connection type in the block-relay-only P2P graph)
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
2908 | @@ -2909,13 +2909,13 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, 2909 | return; 2910 | } 2911 | 2912 | - // We won't accept tx inv's if we're in blocks-only mode, or this is a 2913 | + // Reject tx INVs when the -blocksonly setting is enabled, or this is a 2914 | // block-relay-only peer 2915 | - bool fBlocksOnly = m_ignore_incoming_txs || (pfrom.m_tx_relay == nullptr); 2916 | + bool reject_tx_invs{m_ignore_incoming_txs || (pfrom.m_tx_relay == nullptr)};
Why not calling it ignore? Reject sounds like something proactive.
It will disconnect the peer, which seems proactive and stronger than "ignore"
Good point, I forgot it disconnects. Still unsure "reject" captures the meaning tho. I don't have a better alternative to suggest at this point so feel free to ignore.
Happy to change when there is a better name. Resolving for now.
Code review ACK fa66a7d732f9fd60d72f22087f0d5aadf3064bfb