test: refactor: make chain_dir consistent with CreateBaseChainParams #36320

pull ekzyis wants to merge 1 commits into bitcoin:master from ekzyis:test-mainnet-chain-dir changing 5 files +10 −5
  1. ekzyis commented at 5:57 PM on September 23, 2026: contributor

    The chain_dir() method of test framework nodes returned the chain name for every non-signet chain, but mainnet stores its data in the top-level data directory. Mainnet tests worked around this by setting self.chain to the empty string, which doubles as the datadir name.

    Instead of this workaround, we now set self.chain to "main" and map it to an empty datadir and config section key, so tests can name the chain the way the rest of the codebase does.

    This was mentioned in #34566 (review).

  2. DrahtBot added the label Tests on Sep 23, 2026
  3. DrahtBot commented at 5:58 PM on September 23, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK ismaelsadeeq, maflcko, sedited

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. DrahtBot added the label CI failed on Sep 23, 2026
  5. DrahtBot removed the label CI failed on Sep 23, 2026
  6. in test/functional/test_framework/util.py:521 in 0cea924d33 outdated
     517 | @@ -518,8 +518,11 @@ def initialize_datadir(dirname, n, chain, disable_autoconnect=True):
     518 |  
     519 |  
     520 |  def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=True):
     521 | -    # Translate chain subdirectory name to config name
     522 | -    if chain == 'testnet3':
     523 | +    # Translate chain name to config name
    


    ismaelsadeeq commented at 4:41 PM on September 29, 2026:

    In "test: refactor: make chain_dir consistent with CreateBaseChainParams" 0cea924d3326a787ed068d526f7396c6561ff6b9

    nit: It is unclear at first why we need to set chain name and chain name conf section to None.

    But its because after this change, chain is "main" so the chain_name_conf and chain_name_conf_section needs to be handled else they will have "main" which is not correct. Maybe mention that in the commit message?


    ekzyis commented at 6:22 PM on September 29, 2026:

    Yeah, sorry, the generated commit message was confusing. I let Claude write it, and it phrased it like this:

    and translate it to no chain argument and no config section in write_config

    I rewrote it in my own words now in a4bc96966f. Hopefully it makes more (human) sense now!

    Also updated PR description with the new commit message.

  7. ismaelsadeeq commented at 4:50 PM on September 29, 2026: member

    Code review ACK 0cea924d3326a787ed068d526f7396c6561ff6b9

    This is a simple PR that makes chain_dir consistent with CreateBaseChainParams.

    I have built and tested the PR and verified that there are no other call sites where self.chain="".

  8. ekzyis force-pushed on Sep 29, 2026
  9. test: refactor: make chain_dir consistent with CreateBaseChainParams
    The chain_dir() method of test framework nodes returned the chain *name*
    for every non-signet chain, but mainnet stores its data in the top-level
    data directory. Mainnet tests worked around this by setting self.chain
    to the empty string, which doubles as the datadir name.
    
    Instead of this workaround, we now set self.chain to "main" and map it
    to an empty datadir and config section key, so tests can name the chain
    the way the rest of the codebase does.
    a4bc96966f
  10. ekzyis force-pushed on Sep 29, 2026
  11. DrahtBot added the label CI failed on Sep 29, 2026
  12. DrahtBot removed the label CI failed on Sep 29, 2026
  13. ismaelsadeeq commented at 7:02 AM on September 30, 2026: member

    reACK a4bc96966faa9efcd7b387907d51b4ac53f7039d

  14. maflcko commented at 7:43 AM on September 30, 2026: member

    lgtm ACK a4bc96966faa9efcd7b387907d51b4ac53f7039d

  15. sedited approved
  16. sedited commented at 8:53 AM on October 5, 2026: contributor

    ACK a4bc96966faa9efcd7b387907d51b4ac53f7039d

  17. sedited merged this on Oct 5, 2026
  18. sedited closed this on Oct 5, 2026

  19. ekzyis deleted the branch on Oct 7, 2026

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-10-14 20:51 UTC

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