Commit 30308cc
committed
Merge bitcoin#20196: net: fix GetListenPort() to derive the proper port
7d64ea4 net: only assume all local addresses if listening on any (Vasil Dimov)
0cfc0cd net: fix GetListenPort() to derive the proper port (Vasil Dimov)
f98cdcb net: pass Span by value to CaptureMessage() (Vasil Dimov)
3cb9d9c net: make CaptureMessage() mockable (Vasil Dimov)
43868ba timedata: rename variables to match the coding style (Vasil Dimov)
60da1ea timedata: make it possible to reset the state (Vasil Dimov)
Pull request description:
`GetListenPort()` uses a simple logic: "if `-port=P` is given, then we
must be listening on `P`, otherwise we must be listening on `8333`".
This is however not true if `-bind=` has been provided with `:port` part
or if `-whitebind=` has been provided. Thus, extend `GetListenPort()` to
return the port from `-bind=` or `-whitebind=`, if any.
Also, if `-bind=` is provided then we would bind only to a particular address
and should not add all the other addresses of the machine to the list of
local addresses.
Fixes bitcoin#20184
ACKs for top commit:
sipa:
utACK 7d64ea4. I didn't review the tests in detail.
jonatack:
re-ACK 7d64ea4 per `git range-diff 08bcfa2 35ec977 7d64ea4`, changes are rebase-only, light re-review, re-ran the new tests locally
Tree-SHA512: 45135ab9c0ec3cc8c83e3b3e58a1c1f77eaeaba00618d54f1010db1d23d6db7d9c0dc7807e72ebc34e8b2d0e91f1e0d0e9239d13b90f1bdce8be84459e7837f0File tree
12 files changed
+454
-27
lines changed- src
- test
- test/functional
12 files changed
+454
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1668 | 1668 | | |
1669 | 1669 | | |
1670 | 1670 | | |
1671 | | - | |
1672 | | - | |
1673 | 1671 | | |
1674 | 1672 | | |
1675 | 1673 | | |
| |||
1689 | 1687 | | |
1690 | 1688 | | |
1691 | 1689 | | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
1692 | 1694 | | |
1693 | 1695 | | |
1694 | 1696 | | |
| |||
1701 | 1703 | | |
1702 | 1704 | | |
1703 | 1705 | | |
1704 | | - | |
| 1706 | + | |
1705 | 1707 | | |
1706 | 1708 | | |
1707 | 1709 | | |
| |||
1758 | 1760 | | |
1759 | 1761 | | |
1760 | 1762 | | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
1761 | 1769 | | |
1762 | 1770 | | |
1763 | 1771 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
129 | 154 | | |
130 | 155 | | |
131 | 156 | | |
| |||
221 | 246 | | |
222 | 247 | | |
223 | 248 | | |
224 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
225 | 260 | | |
226 | 261 | | |
227 | 262 | | |
| |||
3085 | 3120 | | |
3086 | 3121 | | |
3087 | 3122 | | |
3088 | | - | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
3089 | 3127 | | |
3090 | 3128 | | |
3091 | 3129 | | |
| |||
3112 | 3150 | | |
3113 | 3151 | | |
3114 | 3152 | | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
185 | 193 | | |
| 194 | + | |
186 | 195 | | |
187 | 196 | | |
188 | 197 | | |
| |||
1272 | 1281 | | |
1273 | 1282 | | |
1274 | 1283 | | |
1275 | | - | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
1276 | 1295 | | |
1277 | 1296 | | |
1278 | 1297 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2711 | 2711 | | |
2712 | 2712 | | |
2713 | 2713 | | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
2714 | 2718 | | |
2715 | 2719 | | |
2716 | 2720 | | |
| |||
0 commit comments