Skip to content

Conversation

stickies-v
Copy link
Contributor

@stickies-v stickies-v commented Jan 12, 2023

Two follow-ups for #26695, both refactoring and no observed (*) behaviour change:

  • Rename gArgs to args because it's not actually a global
  • Add BlockAssembler::Options as a (private) member to BlockAssembler to avoid having to assign all the options individually, essentially duplicating them

Reduces LoC and makes the code more readable, in my opinion.


(*) as pointed out by ajtowns, this PR changes the interface of ApplyArgsManOptions(), making this not a pure refactoring PR. In practice, ApplyArgsManOptions() is never called in such a way that this leads to observed behaviour change. Regardless, I've carved out the potential behaviour change into a separate commit and would be okay with dropping it, should it turn out to be controversial.

Avoid confusion with the global gArgs
@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 12, 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 TheCharlatan, glozow

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:

  • #27018 (mempool / miner: regularly flush below-minrelayfeerate entries, mine everything in the mempool by glozow)

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.

@maflcko maflcko changed the title refactor: follow-ups for #26695 refactor: src/node/miner cleanups, follow-ups for #26695 Jan 12, 2023
Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

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

thanks for the followup, light review ACK c14cf65

Add Options as a member to BlockAssembler to avoid having to assign
all the options individually.

Additionally brings the struct more in line with how we typically
define default and ArgManager values, as e.g. with
ChainstateManager::Options and and CTxMemPool::Options
ApplyArgsManOptions does not need to set default values for missing
arguments, these are already defined in the BlockAssembler::Options.

This commit changes the interface of ApplyArgsManOptions(). If
ApplyArgsManOptions() is called again after a option is changed,
this option will no longer be reset to the default value.

There is no observed behaviour change due to how
ApplyArgsManOptions() is currently used, and the new interface is
consistent with e.g. ValidationCacheSizes and MemPoolLimits.
@stickies-v stickies-v changed the title refactor: src/node/miner cleanups, follow-ups for #26695 src/node/miner cleanups, follow-ups for #26695 Jan 16, 2023
@stickies-v
Copy link
Contributor Author

Force pushed to address review comments (thank you @ajtowns):

  • made m_options const by adding a ClampOptions helper function
  • carved out the ApplyArgsManOptions() (potential/unobserved) behaviour change into a separate commit

Copy link
Contributor

@TheCharlatan TheCharlatan 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 6a5e88e

#ifndef BITCOIN_NODE_MINER_H
#define BITCOIN_NODE_MINER_H

#include <policy/policy.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: IWYU says you can now remove this include from miner.cpp

@glozow
Copy link
Member

glozow commented Feb 20, 2023

ACK 6a5e88e

@glozow glozow merged commit 08b65df into bitcoin:master Feb 20, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 25, 2023
@stickies-v stickies-v deleted the w/n26695-followups branch March 14, 2023 11:30
@bitcoin bitcoin locked and limited conversation to collaborators Mar 13, 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.

5 participants