mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 02:31:05 +02:00
test: avoid generating non-loopback traffic from p2p_seednode.py
`p2p_seednode.py` would try to connect to `0.0.0.1` and `0.0.0.2` as seed nodes. This sends outbound TCP packets on a non-loopback interface to the default router. Configure an unavailable proxy for all executions of `bitcoind` during this test. Also change `0.0.0.1` and `0.0.0.2` because connecting to them would skip the `-proxy=` setting because for such an address: * `CNetAddr::IsLocal()` is true, thus * `CNetAddr::IsRoutable()` is false, thus * `CNetAddr::GetNetwork()` is `NET_UNROUTABLE`, even though `CNetAddr::m_net` is `NET_IPV4`. This speeds up the execution time of `p2p_seednode.py` from 12.5s to 2.5s.
This commit is contained in:
@ -13,6 +13,10 @@ import struct
|
||||
import array
|
||||
import os
|
||||
|
||||
# Easily unreachable address. Attempts to connect to it will stay within the machine.
|
||||
# Used to avoid non-loopback traffic or DNS queries.
|
||||
UNREACHABLE_PROXY_ARG = '-proxy=127.0.0.1:1'
|
||||
|
||||
# STATE_ESTABLISHED = '01'
|
||||
# STATE_SYN_SENT = '02'
|
||||
# STATE_SYN_RECV = '03'
|
||||
|
Reference in New Issue
Block a user