Remove gArgs #21005

issue maflcko opened this issue on January 25, 2021
  1. maflcko commented at 6:28 PM on January 25, 2021: member

    The gArgs global should be removed.

    Motivation

    Bitcoin Core has a single gArgs, which is used by all binaries (bitcoind, bitcoin-qt, bench_bitcoin, bitcoin-wallet, ...). This is generally fine, because binaries only need to parse arguments for themselves.

    However, for testing purposes in bench_bitcoin, some benchmarks spin up a Bitcoin Core node via the TestingSetup NodeContext. Thus, they will end up with conflicting use of gArgs. This issue is popping up too often for me. For example #18662, #21003, ...

    Moreover, test_bitcoin might want to set up and pass around local ArgsManagers without modifying the "main" global gArgs.

    And finally, globals usually come with other issues such as the static initialization fiasco. Getting rid of them will make the code cleaner.

    However, "the GUI already relies on a global QApplication instance, a global event loop, global settings state and probably other global state, so getting rid of gArgs there doesn't seem to accomplish much." (See https://github.com/bitcoin-core/gui/pull/75#issuecomment-689675368)

  2. maflcko added the label Feature on Jan 25, 2021
  3. maflcko added the label Refactoring on Jan 25, 2021
  4. maflcko added the label Brainstorming on Jan 25, 2021
  5. maflcko removed the label Feature on Jan 25, 2021
  6. maflcko cross-referenced this on Jan 25, 2021 from issue test: Move MakeNoLogFileContext to libtest_util, and use it in bench by maflcko
  7. practicalswift commented at 11:07 AM on January 26, 2021: contributor

    I don't know about GUI needs, but for non-GUI needs (including fuzzers): Strong Concept ACK :)

  8. kiminuo cross-referenced this on Feb 20, 2021 from issue Move GetDataDir to ArgsManager by kiminuo
  9. fanquake referenced this in commit a839303edc on Apr 20, 2021
  10. kiminuo cross-referenced this on Sep 15, 2021 from issue refactor: Remove `gArgs` from `wallet.h` and `wallet.cpp` (2) by kiminuo
  11. blockstreamsatellite referenced this in commit df3300918d on Oct 28, 2021
  12. blockstreamsatellite referenced this in commit 5f88b92254 on Nov 10, 2021
  13. maflcko referenced this in commit f63bf05e73 on Nov 10, 2021
  14. maflcko cross-referenced this on Nov 26, 2021 from issue [WIP] DRAFT NOMERGE Tidy up RPCTxSerializationFlags by maflcko
  15. kiminuo cross-referenced this on Dec 10, 2021 from issue refactor: Remove `gArgs` from `bdb.h` and `sqlite.h` by kiminuo
  16. maflcko cross-referenced this on Jan 2, 2022 from issue rpc: Add and use EnsureArgsman helper by maflcko
  17. maflcko referenced this in commit 300124dedf on Jan 4, 2022
  18. maflcko referenced this in commit 98e9d8e8e2 on Mar 24, 2022
  19. pablomartin4btc cross-referenced this on Feb 20, 2023 from issue refactor: wallet, remove global 'ArgsManager' dependency by furszy
  20. maflcko closed this on Mar 10, 2023

  21. vijaydasmp referenced this in commit ea11fc38a9 on Dec 11, 2023
  22. vijaydasmp referenced this in commit f9e8062f8b on Feb 3, 2024
  23. bitcoin locked this on Mar 9, 2024

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-05-18 23:53 UTC

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