Skip to content

init: settings, do not load auto-generated warning msg - #29301

Merged
achow101 merged 1 commit into
bitcoin:masterfrom
furszy:2024_settings_dont_load_warning_msg
Jan 31, 2024
Merged

achow101 merged 1 commit into
bitcoin:masterfrom
furszy:2024_settings_dont_load_warning_msg

Conversation

@furszy

@furszy furszy commented Jan 24, 2024

Copy link
Copy Markdown
Member

Fixes #29144 (comment).

The settings warning message is meant to be used only to discourage users from
modifying the file manually. Therefore, there is no need to keep it in memory.

The settings warning message is meant to be used only to discourage
users from modifying the file manually. Therefore, there is no need
to keep it in memory.
@DrahtBot

DrahtBot commented Jan 24, 2024 •

Copy link
Copy Markdown
Contributor

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

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK achow101, ryanofsky

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

@achow101

Copy link
Copy Markdown
Member

ACK 987a1b5

@DrahtBot
DrahtBot removed the request for review from achow101 January 24, 2024 17:52

@ryanofsky ryanofsky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code review ACK 987a1b5. Seems like a clean, simple fix

Comment thread src/common/settings.cpp
};

// Json object key for the auto-generated warning comment
const std::string SETTINGS_WARN_MSG_KEY{"_warning_"};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In commit "init: settings, do not load auto-generated warning msg" (987a1b5)

Not sure, but maybe this can be changed to std::string_view to avoid the need to allocate memory before main() runs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In commit "init: settings, do not load auto-generated warning msg" (987a1b5)

Not sure, but maybe this can be changed to std::string_view to avoid the need to allocate memory before main() runs.

As the settings map take strings for keys, wouldn't this change mean that we would need to static cast string_view to string to not create a copy during the push/erase methods call?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

re: #29301 (comment)

As the settings map take strings for keys, wouldn't this change mean that we would need to static cast string_view to string to not create a copy during the push/erase methods call?

The idea is that just that it is noticeable when programs are slow to start, so you usually want to reduce the amount of code that needs to run before main(), even if it means code that runs later but is less sensitive might be slower. In this case there is not even a need for a tradeoff, though since univalue could take string_view arguments. Just explaining the suggestion though, this is not important

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure, sounds good @ryanofsky. Thanks for coming back to this!

@glozow
glozow requested a review from fanquake January 29, 2024 13:47

@fanquake fanquake left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems fine. Gets rid of the pointless 2024-01-31T10:25:34Z Ignoring unknown rw_settings value _warning_ and
2024-01-31T10:25:34Z Setting file arg: _warning_ = "This file is automatically generated and updated by Bitcoin Core. Please do not edit this file while the node is running, as any changes might be ignored or overwritten." output.

@fanquake fanquake added this to the 27.0 milestone Jan 31, 2024
@achow101
achow101 merged commit 6f7395b into bitcoin:master Jan 31, 2024
@furszy
furszy deleted the 2024_settings_dont_load_warning_msg branch January 31, 2024 21:24
@bitcoin bitcoin locked and limited conversation to collaborators Feb 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants