bitcoin/test/functional/test_framework
fanquake e4487fd5bb
Merge bitcoin/bitcoin#22096: p2p: AddrFetch - don't disconnect on self-announcements
5730a43703 test: Add functional test for AddrFetch connections (Martin Zumsande)
c34ad3309f net, rpc: Enable AddrFetch connections for functional testing (Martin Zumsande)
533500d907 p2p: Add timeout for AddrFetch peers (Martin Zumsande)
b6c5d1e450 p2p: AddrFetch - don't disconnect on self-announcements (Martin Zumsande)

Pull request description:

  AddrFetch connections (old name: oneshots) are intended to be short-lived connections on which we ask a peer for addresses via `getaddr` and disconnect after receiving them.

  This is done by disconnecting after receiving the first `addr`. However, it is no longer working as intended, because nowadays, the first `addr` a typical bitcoin core node sends is its self-announcement.
  So we'll disconnect before the peer gets a chance to answer our `getaddr`.

  I checked that this affects both `-seednode` peers specified manually, and DNS seeds when AddrFetch is used as a fallback if DNS doesn't work for us.

  The current behavior of getting peers via AddrFetch when starting with an empty addrman would be to connect to the peer, receive its self-announcement and add it to addrman, disconnect, reconnect to the same peer again as a full outbound (no other addresses in addrman) and then receive more `addr`. This is silly and not in line with AddrFetch peer being intended to be short-lived peers. 

  Fix this by only disconnecting after receiving an `addr` message of size > 1.

  [Edit] As per review discussion, this PR now also adds a timeout after which we disconnect if we haven't received any suitable `addr`, and a functional test.

ACKs for top commit:
  amitiuttarwar:
    reACK 5730a43703
  naumenkogs:
    ACK 5730a43703
  jnewbery:
    ACK 5730a43703

Tree-SHA512: 8a81234f37e827705138eb254223f7f3b3bf44a06cb02126fc7990b0d231b9bd8f07d38d185cc30d55bf35548a6fdc286b69602498d875b937e7c58332158bf9
2021-07-20 20:27:21 +08:00
..
__init__.py Rename rpc-tests directory to functional 2017-03-20 10:40:31 -04:00
address.py [tests] Replace bytes literals with hex literals 2020-09-03 16:47:49 +01:00
authproxy.py test: retry when write to a socket fails on macOS 2020-06-25 17:26:20 +07:00
bdb.py test: remove unnecessary assignment in bdb 2021-02-09 10:22:50 -03:00
bip340_test_vectors.csv tests: add BIP340 Schnorr signature support to test framework 2020-10-12 17:18:47 -07:00
blocktools.py test: use script_util helpers for creating P2W{PKH,SH} scripts 2021-07-05 20:40:52 +02:00
coverage.py Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
descriptors.py Output a descriptor in createmultisig and addmultisigaddress 2020-01-30 23:55:36 -05:00
key.py test: remove unused function xor_bytes 2021-02-09 17:58:21 +01:00
messages.py Merge bitcoin/bitcoin#22211: net: relay I2P addresses even if not reachable (by us) 2021-07-15 16:53:34 +02:00
muhash.py test: Change MuHash Python implementation to match cpp version again 2020-12-22 01:48:34 +01:00
netutil.py test: Fix IPv6 check on BSD systems 2021-05-30 23:47:50 +02:00
p2p.py test: Fix intermittent issue in p2p_addr_relay.py 2021-04-28 08:16:29 +02:00
script.py Correction for VerifyTaprootCommitment comments 2021-03-01 09:01:48 -05:00
script_util.py scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
segwit_addr.py Use Bech32m encoding for v1+ segwit addresses 2021-03-16 10:48:36 -07:00
siphash.py Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
socks5.py scripted-diff: Update copyright in ./test 2019-03-02 10:58:35 -05:00
test_framework.py add dummy file param to fix jupyter 2021-06-21 17:12:16 +02:00
test_node.py Merge bitcoin/bitcoin#22096: p2p: AddrFetch - don't disconnect on self-announcements 2021-07-20 20:27:21 +08:00
test_shell.py TestShell: Return self from setup() 2019-11-05 12:55:52 +01:00
util.py test: introduce tx_from_hex helper for tx deserialization 2021-06-21 14:28:05 +02:00
wallet.py Merge bitcoin/bitcoin#22089: test: MiniWallet: fix fee calculation for P2PK and check tx vsize 2021-06-21 16:11:13 +02:00
wallet_util.py test: use script_util helpers for creating P2W{PKH,SH} scripts 2021-07-05 20:40:52 +02:00