test: Fix verack race to avoid intermittent test failures #18866

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2005-qaVerackRace changing 1 files +5 −1
  1. MarcoFalke commented at 12:56 PM on May 4, 2020: member

    Fixes #18832

  2. test: Fix verack race to avoid intermittent test failures fae153b409
  3. MarcoFalke force-pushed on May 4, 2020
  4. laanwj added the label P2P on May 4, 2020
  5. laanwj added the label Tests on May 4, 2020
  6. laanwj removed the label P2P on May 4, 2020
  7. in test/functional/test_framework/util.py:398 in fae153b409
     390 | @@ -391,7 +391,11 @@ def connect_nodes(from_connection, node_num):
     391 |      from_connection.addnode(ip_port, "onetry")
     392 |      # poll until version handshake complete to avoid race conditions
     393 |      # with transaction relaying
     394 | -    wait_until(lambda:  all(peer['version'] != 0 for peer in from_connection.getpeerinfo()))
     395 | +    # See comments in net_processing:
     396 | +    # * Must have a version message before anything else
     397 | +    # * Must have a verack message before anything else
     398 | +    wait_until(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo()))
     399 | +    wait_until(lambda: all(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in from_connection.getpeerinfo()))
    


    laanwj commented at 10:37 AM on May 6, 2020:

    It's slightly hacky to use the receive statistics here to see if the local peer has received the verack message and completed the handshake. But the only way to do it without RPC changes, I suppose.


    MarcoFalke commented at 3:09 PM on May 6, 2020:

    There is fSuccessfullyConnected or so, which should do the same thing, but yeah it is not exposed on RPC

  8. laanwj commented at 10:38 AM on May 6, 2020: member

    ACK fae153b40968bfd974a4709bcd841a59447abf18

  9. MarcoFalke merged this on May 8, 2020
  10. MarcoFalke closed this on May 8, 2020

  11. MarcoFalke deleted the branch on May 8, 2020
  12. sidhujag referenced this in commit 231392771c on May 12, 2020
  13. ComputerCraftr referenced this in commit 28a494d680 on Jun 10, 2020
  14. ComputerCraftr referenced this in commit 45df3f5020 on Jun 10, 2020
  15. jasonbcox referenced this in commit a73453dd27 on Sep 12, 2020
  16. PastaPastaPasta referenced this in commit 190726ad49 on Jun 27, 2021
  17. PastaPastaPasta referenced this in commit fd6a732710 on Jun 28, 2021
  18. PastaPastaPasta referenced this in commit 7de0956a4c on Jun 29, 2021
  19. PastaPastaPasta referenced this in commit 608772114f on Jul 1, 2021
  20. PastaPastaPasta referenced this in commit 7c1ea4174a on Jul 1, 2021
  21. PastaPastaPasta referenced this in commit be891457d1 on Jul 14, 2021
  22. PastaPastaPasta referenced this in commit 8c1a763ccc on Jul 15, 2021
  23. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

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-14 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me