-
Notifications
You must be signed in to change notification settings - Fork 37.7k
addrman: Make addrman a top-level component #20228
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
Conversation
does it conceptually make sense to have an addrman without connman or connman without addrman? I'd say no.
An alternative to achieve that would be to let PeerMan steal a reference to addrman from connman (and assign it to m_addrman) |
In general to have things double or more if ( ,,,) or detrimental decision processes in the same code is a good design in industry where u can kill ppl easy, if there is no double check and just one bit ( that could be just by chance or external forces have flipped ) decides over mayhem. In financials we used to do that the same and wrote "bad ugly code". bcs u get no bonus at the years end, if the code "looks" good but your customers got screwed. Unless that was ur biz. |
Why not? If |
Fixed whitespace linter issue |
1b6dbae
to
e160909
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, 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. |
This doesn't compile on gcc4.8, but we'll drop support for that soon anyway, so the failure can be ignored/rebased out when 22.0 is branched off. |
e160909
to
1755f08
Compare
Hopefully fixed |
1755f08
to
98551d3
Compare
98551d3
to
d71274d
Compare
rebased |
concept ACK |
rebased |
d71274d
to
d280f67
Compare
d280f67
to
ef7c0c3
Compare
a765e9b
to
8715f8d
Compare
node.context owns the CAddrMan. CConnman holds a reference to the CAddrMan.
It just forwards calls to CAddrMan::SetServices.
It just forwards calls to CAddrMan::Good.
It just forwards calls to CAddrMan::Add.
8715f8d
to
880cea7
Compare
Thanks for the review @MarcoFalke. I've addressed all of your comments. |
@MarcoFalke - I've taken your suggested diff. |
2d7fa2d
to
06653e4
Compare
re-ACK 06653e4 🕸 Only changes:
Show signature and timestampSignature:
Timestamp of file with hash |
Could squash the last two commits and mention that |
PeerManager can just call directly into CAddrMan::Connected() now.
06653e4
to
3fc06d3
Compare
Done
I tried this and it wasn't very useful - there are only a couple of lines that are moved without changing. |
re-ACK 3fc06d3 only change is squash 🏀 Show signature and timestampSignature:
Timestamp of file with hash |
5555446 fuzz: Use ConsumeWeakEnum in addrman for service flags (MarcoFalke) Pull request description: This has minimally better performance. Reported by me in bitcoin/bitcoin#20228 (comment) ACKs for top commit: practicalswift: Tested ACK 5555446 vasild: ACK 5555446 Tree-SHA512: 4e5f51fe4f2bd7b2f37d0690e41203341ba45c0c9bc9247449cd26cfb5f77dc2ec61df3e4963276f68694e4b3ca3d0a76367a51c4d775501edeb3224d305a261
… flags 5555446 fuzz: Use ConsumeWeakEnum in addrman for service flags (MarcoFalke) Pull request description: This has minimally better performance. Reported by me in bitcoin#20228 (comment) ACKs for top commit: practicalswift: Tested ACK 5555446 vasild: ACK 5555446 Tree-SHA512: 4e5f51fe4f2bd7b2f37d0690e41203341ba45c0c9bc9247449cd26cfb5f77dc2ec61df3e4963276f68694e4b3ca3d0a76367a51c4d775501edeb3224d305a261
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 3fc06d3
@sipa do you mind rereviewing this? It has two ACKs on the current branch. |
Addrman is currently a member variable of connman. Make it a top-level component with lifetime owned by node.context, and add a reference to addrman in peerman. This allows us to eliminate some functions in connman that are simply forwarding requests to addrman, and simplifies the connman-peerman interface.
By constructing the addrman in init, we can also add parameters to the ctor, which allows us to test it better. See #20233, where we enable consistency checking for addrman in our functional tests.