Skip to content

Conversation

ryanofsky
Copy link
Contributor

Most of the code in util/system.cpp that was hardcoded to use the global ArgsManager instance gArgs has been changed to stop using it (for example in #20092). But a few hardcoded references to gArgs remain. This commit removes the last ones so these functions aren't reading or writing global state.

Noticed these gArgs references while reviewing #27073

New function was introduced by willcl-ark <will@256k1.dev> in commit
56e370f from
bitcoin#27073 and removes some duplicate code.
Most of the code in util/system.cpp that was hardcoded to use the global
ArgsManager instance `gArgs` has been changed to work with explicit ArgsManager
instances (for example in bitcoin#20092). But a
few hardcoded references to `gArgs` remain. This commit removes the last ones
so these functions aren't reading or writing global state.
@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 27, 2023

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK willcl-ark, stickies-v, achow101
Concept ACK TheCharlatan, fanquake, hebasto

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #27150 (Deduplicate bitcoind and bitcoin-qt init code by ryanofsky)
  • #10102 (Multiprocess bitcoin by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@TheCharlatan
Copy link
Contributor

Concept ACK

@fanquake
Copy link
Member

Concept ACK

@hebasto
Copy link
Member

hebasto commented Feb 28, 2023

Concept ACK.

Copy link
Contributor

@stickies-v stickies-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

light code review ACK 9a9d5da

Copy link
Member

@willcl-ark willcl-ark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 9a9d5da

Tidy changes to remove the last references to global gArgs from util/system.cpp (besides the global declaration).

Copy link
Contributor

@stickies-v stickies-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 9a9d5da

@@ -1068,8 +1068,8 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
}

// If datadir is changed in .conf file:
gArgs.ClearPathCache();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Looks like this shouldn't have been called on gArgs regardless of this PR, perhaps useful to split out in separate commit? In the 3 callsites of ArgsManager::ReadConfigFiles I see, it is only called on gArgs anyway, so I don't see any actual behaviour change/potential bug because of it.

@achow101
Copy link
Member

ACK 9a9d5da

@achow101 achow101 merged commit 8303f11 into bitcoin:master Feb 28, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 1, 2023
hebasto added a commit to hebasto/gui-qml that referenced this pull request Apr 23, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants