In order to help debug issues with previous release downloads from our web server, we need to know which IP the downloader connected to.
test: Log IP of download server in get_previous_releases.py #34045
pull achow101 wants to merge 1 commits into bitcoin:master from achow101:log-prev-releases-ip changing 1 files +3 −0-
achow101 commented at 7:10 PM on December 10, 2025: member
- DrahtBot added the label Tests on Dec 10, 2025
-
DrahtBot commented at 7:10 PM on December 10, 2025: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
Code Coverage & Benchmarks
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34045.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste <code><!--meta-tag:bot-skip--></code> into the comment that the bot should ignore.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
-
in test/get_previous_releases.py:126 in 552d780403
122 | @@ -122,6 +123,9 @@ def progress_hook(progress_bytes, total_size): 123 | if response.status != 200: 124 | raise RuntimeError(f"HTTP request failed with status code: {response.status}") 125 | 126 | + sock_info = socket.fromfd(response.fileno(), socket.AF_INET, socket.SOCK_STREAM).getpeername()
janb84 commented at 7:37 PM on December 10, 2025:Are the server IP addresses always IPv4 ?
Socket.AF_INETis ipv4 onlyYes it works but give wrong ipv6 address :
Connected to 2620:6e:a004:1:30b4:de03:100:0 Connected to 2620:6e:a004:1::b1c:c05e dig AAAA bitcoincore.org bitcoincore.org. 3063 IN AAAA 2620:6e:a004:1::b1c:c05esock_info = response.fp.raw._sock .getpeername() print(f"Connected to {sock_info[0]}")This works (second answer) but is not the highest of quality code.
achow101 commented at 8:14 PM on December 10, 2025:No, it can be IPv6. But since we aren't ever going to actually use this socket,
AF_INETdoesn't matter. The logging still works correctly with IPv6.
janb84 commented at 8:16 PM on December 10, 2025:oke, thanks, please validate that it returns the correct ipv6 addresses, see my edit :) happy to be wrong
achow101 commented at 8:26 PM on December 10, 2025:Using your suggestion, I think it will work more reliably.
achow101 force-pushed on Dec 10, 2025DrahtBot added the label CI failed on Dec 10, 2025test: Log IP of download server in get_previous_releases.py cdaf25f9c3in test/get_previous_releases.py:21 in 0a06309cb8
17 | @@ -18,6 +18,7 @@ 18 | import re 19 | import shutil 20 | import subprocess 21 | +import socket
l0rinc commented at 9:44 PM on December 10, 2025:new import seems unnecessary now
achow101 commented at 9:49 PM on December 10, 2025:Removed
achow101 force-pushed on Dec 10, 2025in test/get_previous_releases.py:126 in cdaf25f9c3
121 | @@ -122,6 +122,9 @@ def progress_hook(progress_bytes, total_size): 122 | if response.status != 200: 123 | raise RuntimeError(f"HTTP request failed with status code: {response.status}") 124 | 125 | + sock_info = response.fp.raw._sock.getpeername() 126 | + print(f"Connected to {sock_info[0]}")
l0rinc commented at 10:05 PM on December 10, 2025:I'm fine with this as well, alternatively to document what we're connecting to, we could unpack the
ipfrom the(host, port)/(host, port, flowinfo, scope_id)tuples with something like:ip, *_ = response.fp.raw._sock.getpeername() print(f"Connected to {ip}")or
ip = response.fp.raw._sock.getpeername()[0] print(f"Connected to {ip}")l0rinc approvedl0rinc commented at 10:06 PM on December 10, 2025: contributoruntested ACK cdaf25f9c3e56b4e80b90a471bdc0a175160534c
DrahtBot removed the label CI failed on Dec 10, 2025janb84 commented at 10:09 AM on December 11, 2025: contributorACK cdaf25f9c3e56b4e80b90a471bdc0a175160534c
Thanks for incorporating my suggestion.
rkrux approvedrkrux commented at 10:51 AM on December 11, 2025: contributortACK cdaf25f9c3e56b4e80b90a471bdc0a175160534c
fjahr commented at 2:55 PM on December 11, 2025: contributorutACK cdaf25f9c3e56b4e80b90a471bdc0a175160534c
glozow commented at 4:35 PM on December 11, 2025: memberACK cdaf25f9c3e56b4e80b90a471bdc0a175160534c
glozow merged this on Dec 11, 2025glozow closed this on Dec 11, 2025
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 00:12 UTC
More mirrored repositories can be found on mirror.b10c.me