RPC/Wallet: Access wallets via interfaces::Wallet #26082

pull luke-jr wants to merge 8 commits into bitcoin:master from luke-jr:rpc_wallet_interfaces changing 8 files +125 −106
  1. luke-jr commented at 10:51 PM on September 13, 2022: member

    This is a minimal "step 1" to migrating wallet RPC methods to access via the abstract interfaces. Only trivial methods are ported at this stage.

    Long term goal is to support different actual wallet classes (in particular, core-lighting wallets) which won't have remotely the same internals as Bitcoin Core wallets.

  2. RPC/Wallet: Add GetWalletInterfaceForJSONRPCRequest helper 5df681922e
  3. Wallet: Add destIsMine to interfaces::Wallet 680a0ac71e
  4. RPC/Wallet: addresses: Convert RPCs to use interfaces::Wallet where simple
    getnewaddress, setlabel, and walletdisplayaddress
    cfdef6cf27
  5. RPC/Wallet: coins: Convert listlockunspent RPC to use interfaces::Wallet f00ce8bcea
  6. RPC/Wallet: encrypt: Convert walletpassphrasechange RPC to use interfaces::Wallet 88a1884919
  7. Wallet: Add missing const attribute to interfaces cc0a1d565e
  8. RPC/Wallet: Support interfaces::Wallet in EnsureWalletIsUnlocked a1be2b07ce
  9. RPC/Wallet: signmessage: Convert RPC to use interfaces::Wallet 9c52aa7ae9
  10. w0xlt commented at 11:34 PM on September 13, 2022: contributor

    Approach ACK. This provides a better separation of concerns.

  11. S3RK commented at 7:09 AM on September 14, 2022: contributor

    Can you elaborate on "support different actual wallet classes (in particular, core-lighting wallets)"? I always though of lighting wallets operating on another abstraction layer on-top of bitcoin wallets, i.e. bitcoin wallets abstract the use of the blockchain while lighting wallets make use of that. Thus it seems like lighting wallets should have different interface from bitcoin wallets.

  12. DrahtBot commented at 9:25 AM on September 14, 2022: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Approach ACK w0xlt

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #26365 (wallet: GetEffectiveBalance by willcl-ark)
    • #26347 (wallet: ensure the wallet is unlocked when needed for rescanning by ishaanam)
    • #26294 (build: move util/url to common/url by fanquake)
    • #24897 ([Draft / POC] Silent Payments by w0xlt)
    • #24313 (Improve display address handling for external signer by Sjors)
    • #24058 (BIP-322 basic support by kallewoof)

    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.

  13. luke-jr commented at 11:34 AM on September 14, 2022: member

    Can you elaborate on "support different actual wallet classes (in particular, core-lighting wallets)"? I always though of lighting wallets operating on another abstraction layer on-top of bitcoin wallets, i.e. bitcoin wallets abstract the use of the blockchain while lighting wallets make use of that. Thus it seems like lighting wallets should have different interface from bitcoin wallets.

    Wallets in general are at the same abstraction layer. Most interfaces are common whether you're sending/receiving on-chain or Lightning.

  14. ryanofsky commented at 6:16 PM on September 14, 2022: contributor

    I think this is a good change for a different reason than the one stated. Even if there won't be multiple wallet implementations, letting RPC methods interact with wallets through the interfaces::Wallet class instead of the CWallet class means new RPC methods can avoid accessing internal wallet state just like GUI code avoids it, and new RPC features should be easier to port to the GUI because they can be implemented behind the interface rather than on top of it.

    One suggestion I would have is to drop commit "Wallet: Add missing const attribute to interfaces" (cc0a1d565e1aeb9f399a6b406528a80f4d0d0180) from this PR. The interface::Wallet class is an abstract class and the methods it declares are intentionally non-const, because making them const exposes internal implementation details of interface::Wallet subclasses that callers should not be aware of. In practice, it breaks multiprocess support (see #25337 (review), commit e81daff985867bfe88fdef325384dac344eb6aad from #10102). Dropping this would also make the PR more focused and smaller.

  15. S3RK commented at 6:59 PM on September 14, 2022: contributor

    I think this is a good change for a different reason than the one stated. Even if there won't be multiple wallet implementations, letting RPC methods interact with wallets through the interfaces::Wallet class instead of the CWallet class means new RPC methods can avoid accessing internal wallet state just like GUI code avoids it, and new RPC features should be easier to port to the GUI because they can be implemented behind the interface rather than on top of it.

    Agree that having RPC interacting through clear interface is great. Maybe we should discuss the long-term goal "to support different actual wallet classes (in particular, core-lighting wallets)" in some other place.

  16. maflcko referenced this in commit 0cfbb171bd on Sep 24, 2022
  17. sidhujag referenced this in commit 9547d5270a on Sep 25, 2022
  18. DrahtBot added the label Needs rebase on Nov 1, 2022
  19. DrahtBot commented at 7:27 PM on November 1, 2022: contributor

    <!--cf906140f33d8803c4a75a2196329ecb-->

    🐙 This pull request conflicts with the target branch and needs rebase.

  20. bitcoin deleted a comment on Dec 5, 2022
  21. fanquake marked this as a draft on Feb 6, 2023
  22. fanquake commented at 2:56 PM on February 6, 2023: member

    Moved to draft, as it looks like this needs further discussion, and has needed rebase for 3 months.

  23. DrahtBot commented at 12:14 AM on May 7, 2023: contributor

    <!--13523179cfe9479db18ec6c5d236f789-->

    There hasn't been much activity lately and the patch still needs rebase. What is the status here?

    • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
    • Is it no longer relevant? ➡️ Please close.
    • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.
  24. DrahtBot commented at 12:28 AM on August 5, 2023: contributor

    <!--13523179cfe9479db18ec6c5d236f789-->

    There hasn't been much activity lately and the patch still needs rebase. What is the status here?

    • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
    • Is it no longer relevant? ➡️ Please close.
    • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.
  25. maflcko commented at 9:08 AM on August 8, 2023: member
  26. DrahtBot commented at 12:09 AM on November 6, 2023: contributor

    <!--13523179cfe9479db18ec6c5d236f789-->

    There hasn't been much activity lately and the patch still needs rebase. What is the status here?

    • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
    • Is it no longer relevant? ➡️ Please close.
    • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.
  27. maflcko commented at 9:32 AM on November 6, 2023: member

    Closing for now. Please leave a comment here, to have it re-opened by someone.

  28. maflcko closed this on Nov 6, 2023

  29. PastaPastaPasta referenced this in commit 5426f0afc4 on Feb 29, 2024
  30. PastaPastaPasta referenced this in commit 7167dd3164 on Feb 29, 2024
  31. PastaPastaPasta referenced this in commit 4d676ce788 on Feb 29, 2024
  32. PastaPastaPasta referenced this in commit 185cf8231e on Feb 29, 2024
  33. bitcoin locked this on Nov 5, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 15:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me