Skip to content

core/blockchain: remove unnecessary fmt.Sprintf in log.Error calls #31842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

MozirDmitriy
Copy link

@MozirDmitriy MozirDmitriy commented May 17, 2025

Replaced redundant usage of fmt.Sprintf inside log.Error calls with direct formatting arguments.
This change improves code clarity and performance.
No functional changes were made.

@@ -652,8 +652,8 @@ func (bc *BlockChain) initializeHistoryPruning(latest uint64) error {
// postmerge directly on an existing DB. We could just trigger the pruning
// here, but it'd be a bit dangerous since they may not have intended this
// action to happen. So just tell them how to do it.
log.Error(fmt.Sprintf("Chain history mode is configured as %q, but database is not pruned.", bc.cacheConfig.ChainHistoryMode.String()))
log.Error(fmt.Sprintf("Run 'geth prune-history' to prune pre-merge history."))
log.Error("Chain history mode is configured as %q, but database is not pruned.", bc.cacheConfig.ChainHistoryMode.String())
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't work, log.Error does not work the same as fmt.Sprintf

@MariusVanDerWijden
Copy link
Member

Yeah I don't think it makes much sense to do this. Its not really important to change this

@MozirDmitriy
Copy link
Author

Yeah I don't think it makes much sense to do this. Its not really important to change this

Ok boss, thanks for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants