diff options
author | Jon Atack <jon@atack.com> | 2021-07-28 17:28:26 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2021-07-28 18:02:02 +0200 |
commit | f8d8eb5fdaa93b6e5b77fd901b94927dc3a0473e (patch) | |
tree | aff4da80c893c6eb910ab6857fcae316aac532ae | |
parent | 9321086af7b75be536767d25abef4d7e02ca416a (diff) |
test: add addr-fetch timeout connection coverage in p2p_addrfetch.py
-rwxr-xr-x | test/functional/p2p_addrfetch.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/functional/p2p_addrfetch.py b/test/functional/p2p_addrfetch.py index 4b15c82489..2a0f6432a9 100755 --- a/test/functional/p2p_addrfetch.py +++ b/test/functional/p2p_addrfetch.py @@ -59,9 +59,20 @@ class P2PAddrFetch(BitcoinTestFramework): peer.wait_for_disconnect(timeout=5) self.log.info("Check timeout for addr-fetch peer that does not send addrs") - peer = node.add_outbound_p2p_connection(P2PInterface(), p2p_idx=1, connection_type="addr-fetch") - node.setmocktime(int(time.time()) + 301) # Timeout: 5 minutes + peer_id = 1 + peer = node.add_outbound_p2p_connection(P2PInterface(), p2p_idx=peer_id, connection_type="addr-fetch") + + time_now = int(time.time()) + self.assert_getpeerinfo(peer_ids=[peer_id]) + + # Expect addr-fetch peer connection to be maintained up to 5 minutes. + node.setmocktime(time_now + 295) + self.assert_getpeerinfo(peer_ids=[peer_id]) + + # Expect addr-fetch peer connection to be disconnected after 5 minutes. + node.setmocktime(time_now + 301) peer.wait_for_disconnect(timeout=5) + self.assert_getpeerinfo(peer_ids=[]) if __name__ == '__main__': |