-
Notifications
You must be signed in to change notification settings - Fork 36.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addrman: Remove addrman hotfixes #22496
addrman: Remove addrman hotfixes #22496
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review ACK 5dc4a74.
As I2P support hasn't even been released yet, it's much simpler and safer not to insert I2P addresses where port! = 0.
Is this pr for 22.0 release? |
The thing is that I2P does support ports other than 0, just not in the currently used SAM proxy version (3.1). But there is no reason future versions of bitcoin core, or other clients, couldn't support I2P with ports. So I'm kind of divided on ignoring them completely, as that will give problems with such addresses not propagating later. See previous discussion here: #21514 (comment) #21514 (comment) . |
|
Instead of deserializing addresses, placing them in the buckets, and then removing them if they're invalid, check first and don't place in the buckets if they're invalid.
5dc4a74
to
65332b1
Compare
I haven't been following the I2P work closely, but I really don't understand the motivation for adding code to addrman in #22112. There are only a handful of people using (pre-release) I2P support, so why was code added to master to patch their addrmans if the intention was to remove that code before release? I don't understand why we'd want to keep I2P addresses in addrman before bitcoind supports them. With the original version of this PR, it would have been easy to implement that - as soon as bitcoind supports non-port-0 I2P addresses, just remove the line from In any case, #22497 was opened shortly after this PR and quickly merged, removing all of the I2P-specific code from addrman, so I've dropped the first commit.
This PR is +7/-40 and makes the addrman code simpler rather than more complicated. Currently, addresses are deserialized from peers.dat, added into buckets, and then removed if they're invalid. It's much simpler to just not add them into those buckets if they're invalid. |
Removing the v22 milestone. Now that the changes from #22112 have been reverted, this isn't urgent. |
Needs OP adjusted? |
Done |
Just to answer the question: the intention was to include it in 22.0, see the commit message of e0a2b39. The reasons why it was removed earlier are stated in the commit message of the removal: d4b67c8. |
utACK 65332b1. I tried to reason through scenarios that could introduce inconsistencies with this code, but can't find any. I'm also working on a POC that replaces addrman's representation with something multiindex based, which is hopefully more easily reviewable for correctness/consistencies. But I'd like the existing addrman PRs in the pipeline to settle first. |
Concept ACK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 65332b1 - Skipping the addition of invalid addresses (this code was initially added for Tor addrs) rather than adding all the invalids then removing them all when finishing unserializing seems like an improvement. Especially if it can be achieved with less code.
Post-merge ACK. |
PRs #22179 and #22112 (EDIT: later reverted in #22497) added hotfix code to addrman to remove invalid addresses and mutate the ports of I2P entries after entering into addrman. Those hotfixes included at least two addrman data corruption bugs:
Hotfixing addrman is inherently dangerous. There are many members that have implicit assumptions on each others' state, and mutating those directly can lead to violating addrman's internal invariants.
Instead of trying to hotfix addrman, just don't insert any invalid addresses. For now, those are addresses which fail
CNetAddr::IsValid()
.