test: fixes p2p_ibd_txrelay wait time #31759

pull sr-gi wants to merge 1 commits into bitcoin:master from sr-gi:2025-01-fix-p2p-ibd-txrelay-test changing 1 files +3 −1
  1. sr-gi commented at 7:27 pm on January 29, 2025: member

    p2p_ibd_txrelay expects no GETDATA to have been received by a peer after announcing a transaction. The reason is that the node is doing IBD, so transaction requests are not replied to. However, the way this is checked is wrong, and the check will pass even if the node was not in IBD.

    This is due to the mocktime not being properly initialized, so the check is always performed earlier than it should, making it impossible for the request to be there.

    This can be checked by modifying the test so the peer is not doing IBD, and checking how the test succeeds on that assert (even though it fails later on, given the nature of the test):

     0index 882f5b5c13..3a69ae5860 100755
     1--- a/test/functional/p2p_ibd_txrelay.py
     2+++ b/test/functional/p2p_ibd_txrelay.py
     3@@ -34,7 +34,7 @@ NORMAL_FEE_FILTER = Decimal(100) / COIN
     4
     5 class P2PIBDTxRelayTest(BitcoinTestFramework):
     6     def set_test_params(self):
     7-        self.setup_clean_chain = True
     8+        # self.setup_clean_chain = True
     9         self.num_nodes = 2
    10         self.extra_args = [
    11             ["-minrelaytxfee={}".format(NORMAL_FEE_FILTER)],
    12@@ -43,9 +43,11 @@ class P2PIBDTxRelayTest(BitcoinTestFramework):
    13
    14     def run_test(self):
    15         self.log.info("Check that nodes set minfilter to MAX_MONEY while still in IBD")
    16-        for node in self.nodes:
    17-            assert node.getblockchaininfo()['initialblockdownload']
    18-            self.wait_until(lambda: all(peer['minfeefilter'] == MAX_FEE_FILTER for peer in node.getpeerinfo()))
    19+        # for node in self.nodes:
    20+        #     assert node.getblockchaininfo()['initialblockdownload']
    21+        #     self.wait_until(lambda: all(peer['minfeefilter'] == MAX_FEE_FILTER for peer in node.getpeerinfo()))
    
  2. test: fixes p2p_ibd_txrelay wait time
    p2p_ibd_txrelay expects no GETDATA to have been received by a peer after
    announcing a transaction. The reason is that the node is doing IBD, so
    transaction requests are not replied to. However, the way this is checked
    is wrong, and the check will pass even if the node **was not** in IBD.
    
    This is due to the mocktime not being properly initialized, so the check
    is always performed earlier than it should, making it impossible for the
    request to be there
    1973a9e4f1
  3. DrahtBot commented at 7:27 pm on January 29, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31759.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK i-am-yuvi, glozow

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label Tests on Jan 29, 2025
  5. i-am-yuvi approved
  6. i-am-yuvi commented at 5:03 am on January 30, 2025: contributor

    ACK 1973a9e4f1dfba57051135d6e1bca80979de3879

    Good catch!

    0p2p_ibd_txrelay.py | ✓ Passed  | 2 s
    1
    2ALL                | ✓ Passed  | 2 s (accumulated) 
    3Runtime: 2 s
    
  7. fanquake requested review from instagibbs on Feb 5, 2025
  8. instagibbs commented at 2:57 pm on February 5, 2025: member
    meta: do we ever want a test to bumpmocktime without setting it first?
  9. glozow commented at 5:52 am on February 6, 2025: member

    ACK 1973a9e4f1dfba57051135d6e1bca80979de3879

    meta: do we ever want a test to bumpmocktime without setting it first?

    No, they always need to setmocktime first. As documented: https://github.com/bitcoin/bitcoin/blob/ae9eaa063b68660cbfef336de52e23a3c2dfda92/test/functional/test_framework/test_node.py#L832-L834

  10. glozow merged this on Feb 6, 2025
  11. glozow closed this on Feb 6, 2025

  12. instagibbs commented at 4:13 pm on February 6, 2025: member
    @glozow managed to misread the changeset, nevermind

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: 2025-02-22 06:12 UTC

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