Commit b0cfe30
fix: tcp node peers discovery (#7438)
Description
---
Fixes base node connectivity issue with other peers when tor is
disabled.
Filters out peers addresses which are unsupported on host machine - this
includes:
- `onion` addresses if user has run `minotari_node` without tor.
- IPv6 addresses if host machine has no IPv6 address
This reduce amount of failed dial attempts to other peers and improves
connectivity overall.
Motivation and Context
---
Some users might not want to run tor with base node so we must ensure
it's still working without it.
How Has This Been Tested?
---
Run test cases in `peer_manager::storage::database::tests` which
validates peer filtering.
Build `minotari_node` and replaced one in the Tari Universe and I have
removed my node data directories including peer_db. I was able to pass
bootstrap and enter header sync with 6 peers on mainnet.
What process can a PR reviewer use to test or verify this change?
---
Code review, running test and same as above - run node and wait until it
get some connections.
Additional check `network.log` for base node to verify if
`minotari_node` was attempting to peers that had only onion address. It
should dial only if address is reachable.
<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->
Breaking Changes
---
- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify
<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- Introduced TransportProtocol to enumerate network address schemes and
configure supported protocols during startup.
- Builder option to set transport protocols; transports now advertise
supported protocols and auto-detect IPv6.
- Peer selection, discovery and dialing honor protocol reachability for
more reliable connections.
- Documentation
- Clarified that peer propagation considers address reachability.
- Tests
- Updated tests to support protocol-aware APIs.
- Chores
- Added runtime dependency to detect IPv6.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: SW van Heerden <swvheerden@gmail.com>1 parent 1022aa8 commit b0cfe30
File tree
32 files changed
+545
-82
lines changed- base_layer
- core/src/test_helpers
- p2p/src
- services/liveness
- comms
- core
- src
- builder
- connection_manager
- peer_manager
- storage
- protocol/messaging
- test_utils
- factories
- transports
- utils
- dht
- examples
- memory_net
- propagation
- src
- network_discovery
- test_utils
- tests
32 files changed
+545
-82
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
332 | 331 | | |
333 | 332 | | |
334 | 333 | | |
| 334 | + | |
335 | 335 | | |
336 | | - | |
| 336 | + | |
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
| 471 | + | |
471 | 472 | | |
472 | 473 | | |
473 | 474 | | |
| |||
491 | 492 | | |
492 | 493 | | |
493 | 494 | | |
494 | | - | |
| 495 | + | |
495 | 496 | | |
496 | 497 | | |
497 | 498 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
30 | 29 | | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
104 | 123 | | |
105 | 124 | | |
106 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| |||
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| |||
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
313 | 322 | | |
314 | 323 | | |
315 | 324 | | |
316 | | - | |
| 325 | + | |
| 326 | + | |
317 | 327 | | |
318 | 328 | | |
319 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
| 55 | + | |
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
| |||
589 | 588 | | |
590 | 589 | | |
591 | 590 | | |
592 | | - | |
| 591 | + | |
593 | 592 | | |
594 | 593 | | |
595 | 594 | | |
| |||
603 | 602 | | |
604 | 603 | | |
605 | 604 | | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
606 | 608 | | |
607 | 609 | | |
608 | 610 | | |
609 | 611 | | |
610 | 612 | | |
611 | 613 | | |
612 | | - | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
613 | 618 | | |
614 | 619 | | |
| 620 | + | |
615 | 621 | | |
616 | 622 | | |
617 | 623 | | |
| |||
0 commit comments