8000 refactor: wallet, remove global 'ArgsManager' dependency by furszy · Pull Request #26889 · bitcoin/bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor: wallet, remove global 'ArgsManager' dependency #26889

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

Merged
merged 4 commits into from
Feb 17, 2023

Conversation

furszy
Copy link
Member
@furszy furszy commented Jan 13, 2023

Structurally, the wallet class shouldn't access the global ArgsManager class, its internal behavior shouldn't be coupled to a global command line args parsing object.

So this PR migrates the only two places where we depend on it: (1) the keypool size, and (2) the "-walletnotify" script. And cleans up the, now unneeded, wallet ArgsManager ref member.

Extra note:
In the process of removing the args ref member, discovered and fixed files that were invalidly depending on the wallet header including util/system.h.

@DrahtBot
Copy link
Contributor
DrahtBot commented Jan 13, 2023
edited
Loading

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, hebasto
Concept ACK fanquake
Approach ACK S3RK
Stale ACK pablomartin4btc

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:

  • #26720 (wallet: coin selection, don't return results that exceed the max allowed weight by furszy)
  • #26715 (Introduce MockableDatabase for wallet unit tests by achow101)
  • #26699 (wallet, gui: bugfix, getAvailableBalance skips selected coins by furszy)
  • #26644 (wallet: bugfix, 'wallet_load_ckey' unit test fails with bdb by furszy)
  • #26627 (wallet: Migrate non-HD keys with single combo containing a list of keys by achow101)
  • #26606 (wallet: Implement independent BDB parser by achow101)
  • #26596 (wallet: Migrate legacy wallets to descriptor wallets without requiring BDB by achow101)
  • #26008 (wallet: cache IsMine scriptPubKeys to improve performance of descriptor wallets by achow101)
  • #25907 (wallet: rpc to add automatically generated descriptors by achow101)
  • #25722 (refactor: Use util::Result class for wallet loading by ryanofsky)
  • #25297 (wallet: group independent db writes on single batched db transaction by furszy)
  • #24897 ([Draft / POC] Silent Payments by w0xlt)
  • #19461 (multiprocess: Add bitcoin-gui -ipcconnect option by ryanofsky)
  • #19460 (multiprocess: Add bitcoin-wallet -ipcconnect option 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.

@furszy furszy changed the title wallet: set keypool size instead of access global args manager from spkm [WIP] wallet: set keypool size instead of access global args manager from spkm Jan 14, 2023
@furszy furszy force-pushed the 2022_spkm_keypool_size branch from 561f9ce to d5f494d Compare January 15, 2023 15:19
@furszy furszy changed the title [WIP] wallet: set keypool size instead of access global args manager from spkm wallet: set keypool size instead of access global args manager from spkm Jan 15, 2023
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.

Concept ACK

@furszy furszy changed the title wallet: set keypool size instead of access global args manager from spkm refactor: remove global 'ArgsManager' dependency Jan 18, 2023
@furszy furszy force-pushed the 2022_spkm_keypool_size branch from 2544bda to 928c17d Compare January 18, 2023 13:51
@furszy furszy changed the title refactor: remove global 'ArgsManager' dependency refactor: wallet, remove global 'ArgsManager' dependency Jan 18, 2023
@furszy furszy force-pushed the 2022_spkm_keypool_size branch 2 times, most recently from 23e0d99 to e619065 Compare January 18, 2023 14:06
@S3RK
Copy link
Contributor
S3RK commented Jan 19, 2023

Awesome. Approach ACK

@fanquake
Copy link
Member

Concept ACK

@furszy
Copy link
Member Author
furszy commented Feb 14, 2023

Feedback tackled.
Moved remaining variables to signed type. Small diff.

Copy link
Member
@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

ACK d90b54b

Copy link
Member
@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

re-ACK fa1ce3d

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.

re-ACK fa1ce3d

@fanquake
Copy link
Member

@achow101 can you take a look here

Since we no longer store a ref to the global `ArgsManager`
inside the wallet, we can move the util/system.h
include to the cpp.

This dependency removal opened a can of worms, as few
other places were, invalidly, depending on the wallet's
header including it.
@furszy furszy force-pushed the 2022_spkm_keypool_size branch from fa1ce3d to 52f4d56 Compare February 15, 2023 18:50
@furszy
Copy link
Member Author
furszy commented Feb 15, 2023

Updated per feedback. Thanks.
Single line removal diff.

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.

Re-ACK 52f4d56

@furszy furszy requested review from hebasto and removed request for pablomartin4btc February 17, 2023 13:26
Copy link
Member
@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

re-ACK 52f4d56

@achow101
Copy link
Member

ACK 52f4d56

@achow101 achow101 merged commit 27772d8 into bitcoin:master Feb 17, 2023
Copy link
Member
@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

re-ACK 52f4d56; checked all updates, good stuff!

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 17, 2023
…pendency

52f4d56 refactor: remove <util/system.h> include from wallet.h (furszy)
6c9b342 refactor: wallet, remove global 'ArgsManager' access (furszy)
d8f5fc4 wallet: set '-walletnotify' script instead of access global args manager (furszy)
3477a28 wallet: set keypool_size instead of access global args manager (furszy)

Pull request description:

  Structurally, the wallet class shouldn't access the global `ArgsManager` class, its internal behavior shouldn't be coupled to a global command line args parsing object.

  So this PR migrates the only two places where we depend on it: (1) the keypool size, and (2) the "-walletnotify" script. And cleans up the, now unneeded, wallet `ArgsManager` ref member.

  Extra note:
  In the process of removing the args ref member, discovered and fixed files that were invalidly depending on the wallet header including `util/system.h`.

ACKs for top commit:
  achow101:
    ACK 52f4d56
  TheCharlatan:
    Re-ACK 52f4d56
  hebasto:
    re-ACK 52f4d56

Tree-SHA512: 0cffd99b4dd4864bf618aa45aeaabbef2b6441d27b6dbb03489c4e013330877682ff17b418d07aa25fbe1040bdf2c67d7559bdeb84128c5437bf0e6247719016
@pablomartin4btc
Copy link
Member

Found an issue where @MarcoFalke mentioned the need of removing gArgs from dfferent places and @ryanofsky's comment regarding the GUI specifically, which seem very interesting so I wanted to add the links here.

@furszy furszy deleted the 2022_spkm_keypool_size branch February 27, 2023 20:42
fanquake added a commit to bitcoin-core/gui that referenced this pull request May 11, 2023
…rom blockstorage

5ff63a0 refactor, blockstorage: Replace stopafterblockimport arg (TheCharlatan)
18e5ba7 refactor, blockstorage: Replace blocksdir arg (TheCharlatan)
02a0899 refactor, BlockManager: Replace fastprune from arg with options (TheCharlatan)
a498d69 refactor/iwyu: Complete includes for blockmanager_args (TheCharlatan)
f0bb102 refactor: Move functions to BlockManager methods (TheCharlatan)
cfbb212 zmq: Pass lambda to zmq's ZMQPublishRawBlockNotifier (TheCharlatan)
8ed4ff8 refactor: Declare g_zmq_notification_interface as unique_ptr (TheCharlatan)

Pull request description:

  The libbitcoin_kernel library should not rely on the `ArgsManager`, but rather use option structs that can be passed to the various classes it uses. This PR removes reliance on the `ArgsManager` from the `blockstorage.*` files. Like similar prior work, it uses the options struct in the `BlockManager` that can be populated with `ArgsManager` values.

  Some related prior work: bitcoin/bitcoin#26889 bitcoin/bitcoin#25862 bitcoin/bitcoin#25527 bitcoin/bitcoin#25487

  Related PR removing blockstorage globals: bitcoin/bitcoin#25781

ACKs for top commit:
  ryanofsky:
    Code review ACK 5ff63a0. Since last ACK just added std::move and fixed commit title. Sorry for the noise!
  mzumsande:
    Code Review ACK 5ff63a0

Tree-SHA512: 4bde8fd140a40b97eca923e9016d85dcea6fad6fd199731f158376294af59c3e8b163a0725aa47b4be3519b61828044e0a042deea005e0c28de21d8b6c3e1ea7
@bitcoin bitcoin locked and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants
0