mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 21:52:53 +02:00
The SOCKS5 destinations factory classified connections by scanning debug.log for connection attempts to the requested address and port. The destination is not unique per connection, so the log cannot identify which attempt is being served: first-match returned a stale type when an automatic connection reused an address private broadcast had already used, and latest-match still breaks if two attempts to the same address overlap. Match the exact connection instead: the source addr:port of the proxy's client socket equals the node's addrbind for that peer, so looking it up in getpeerinfo identifies precisely the connection being served and returns its connection_type. This also stops treating debug.log contents as a stable interface. Co-authored-by: Greg Sanders <gsanders87@gmail.com>