Skip to content

Conversation

amadeuszpawlik
Copy link
Contributor

@amadeuszpawlik amadeuszpawlik commented May 18, 2021

net: Remove -feefilter option, as it is debug only and isn't used in any tests. Checking this option for every peer on every iteration of the message handler is unnecessary, as described in #21545.
refactor: Move feefilter logic out into a separate MaybeSendFeefilter(...) function to improve readability of the already long SendMessages(...). fixes #21545

The configuration option -feefilter has been added in 9e072a6: "Implement "feefilter" P2P message"
According to the BIP133, turning the fee filter off was ment for:

[...] a node [...] using prioritisetransaction to accept transactions whose actual fee rates might fall below the node's mempool min fee [in order to] disable the fee filter to make sure it is exposed to all possible txid's

-feefilter was subsequently set as debug only in #8150, with the motivation that the help message was too difficult to translate.

@fanquake fanquake added the P2P label May 18, 2021
@amadeuszpawlik amadeuszpawlik marked this pull request as ready for review May 18, 2021 16:43
@DrahtBot
Copy link
Contributor

DrahtBot commented May 19, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

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.

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.

Thanks for picking this up, and welcome to the project, @amadeuszpawlik!

@laanwj
Copy link
Member

laanwj commented May 19, 2021

net: Remove -feefilter option, as it is debug only and isn't used in any tests

Not a NACK by any means (I don't know the entire history here) but fwiw, "debug only" doesn't necessarily mean test-only. Sometimes obscure options that only make sense in relatively rare conditions, or during development, are labeled as such as well.

Feefilter option is debug only and it isn't used in any tests, it's wasteful
to check this option for every peer on every iteration of the message handler
loop. refs bitcoin#21545
@jonatack
Copy link
Member

jonatack commented May 19, 2021

It looks like this configuration option was added by @morcos in 9e072a6: "Implement "feefilter" P2P message. The "feefilter" p2p message is used to inform other nodes of your mempool min fee which is the feerate that any new transaction must meet to be accepted to your mempool. This will allow them to filter invs to you according to this feerate."

Per https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2016-February/012449.html, its goal was to help reduce
unnecessary network traffic.

See also BIP133: https://github.com/bitcoin/bips/blob/master/bip-0133.mediawiki

@jonatack
Copy link
Member

As a follow-up to my message above, I was curious why -feefilter was turned into a debug message and found #8150. IIUC, a translator found the help message too difficult to translate.

@jnewbery
Copy link
Contributor

Code review ACK b0b6213

@maflcko maflcko changed the title Feefilter cleanups Remove -feefilter option May 20, 2021
@maflcko maflcko changed the title Remove -feefilter option p2p: Remove -feefilter option May 20, 2021
Break SendMessages() function into smaller units to improve readability.
Adds lock assert, as `round()` isn't thread safe.
closes bitcoin#21545
@jnewbery
Copy link
Contributor

Code review ACK a7a43e8

@jonatack
Copy link
Member

Given #21992 (comment) and #21992 (comment) (@amadeuszpawlik, I think that information should have been in the PR description and could still be added), are we certain that this option is unused, unneeded, and should be removed?

@jnewbery
Copy link
Contributor

I agree with @sipa's comment (#8150 (comment)):

I don't think there are good reasons for disabling this in production

This debug only option was added with the original implementation for feefilter, and was used for debugging and testing. It's not used in any of our functional tests, so I'm pretty sure that it's safe to remove.

@jonatack
Copy link
Member

Yes, grepping for DEBUG_ONLY there seem to be some that aren't used in tests but are intended for users, so I'm not sure about "as it is debug only and isn't used in any tests" as a rationale, but it's more of a question than an assertion and I was hoping to hear discussion about it. My informal understanding was more along the lines of #21992 (comment).

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK a7a43e8.

This breaks existing configs but I guess a release note isn't worth it.

@maflcko
Copy link
Member

maflcko commented May 25, 2021

Maybe this was added as an emergency switch to turn off feefilter, should an unexpected integration bug arise in production? Though, now that the feefilter message is being used for years already without such an observed issue, it seems fine to remove.

Generally I am not a fan of undocumented non-self-documenting code. And absent anyone speaking up with a use case (or documentation or test of that use case), this seems fine to remove.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review ACK a7a43e8 🦁

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

review ACK a7a43e8fe85f6247c35d7ff99f36448574f3e34a 🦁
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUh9ywwAwrzAr/Ix4u2TvqUIReJZMThgVWOWl89TTvTVRMCq0w8p+4mcTpdzhIJz
Kdmisf/S1tcgEN6Gtzi82116WgJpwmwQ/nFDB5x9/+chTt45jYu47Ncz6XlUL+2p
OjKTauw8dUfygvxDDCx8xXCczzjR0AHX0xyezm0rt6eNFKs1vUhuqe5azl9MCUv/
/eO+yofKqaWQGsRYRZuOGH6ixqw/EMbSIE7WaeI1A/wDQj8ziQHrvmJ8LF+PBFMw
Htw6fFW52g2y5rZ+lz7lBdPgD2vRTIPOCtwEfH5EzGI3LMSqfqZDYn5P4nc0fe8v
fMBp57dVZ8GC9+p+G6jsjCvmeOSTRgnwpKe4PA8gmFxrtmtfR6+sz8aseVT6PmKc
v3LttgBpPfcEvSxjIVeozTr3a0WkXoZst7UOgkm8hz3tdbDBVMZV/Jw5i9HysJdP
6OJZE5BZrhG1Q8yXhuNkfmMzon2v9/D2IxXuQRMPZWnS/n8kfPaTEYlalUPFZtLM
D2F1Bz3z
=1aDA
-----END PGP SIGNATURE-----

Timestamp of file with hash 461767b35c3b59f11465e878607b812ba3d35fa9a0f66207e25d262a8da4e456 -

@maflcko maflcko merged commit aeecb1c into bitcoin:master May 25, 2021
@amadeuszpawlik amadeuszpawlik deleted the refactor_21545 branch May 25, 2021 12:25
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 25, 2021
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feefilter cleanups
9 participants