refactor: use CWallet const shared pointers in dump{privkey,wallet} #22805

pull theStack wants to merge 3 commits into bitcoin:master from theStack:202108-refactor-const_correctness_for_further_dump_methods changing 3 files +21 −8
  1. theStack commented at 1:33 PM on August 26, 2021: member

    This PR is based on #22787 ("refactor: actual immutable pointing"), which should be reviewed first. (merged by now)

    It aims to make the CWallet shared pointers actually immutable also for the dumpprivkey and dumpwallet RPC methods. For doing that, some more preparations are needed; we need a const-counterpart to the helper EnsureLegacyScriptPubKeyMan that accepts a const CWallet pointer and accordingly also returns a const LegacyScriptPubKeyMan instance. The metadata lookup in dumpwallet is changed to not need a mutable ScriptPubKeyMan instance by avoiding using the operator[] in its mapKeyMetadata map, which also avoids repeated lookups.

  2. fanquake added the label Wallet on Aug 26, 2021
  3. fanquake added the label Refactoring on Aug 26, 2021
  4. DrahtBot commented at 8:50 PM on August 26, 2021: member

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #11803 (Bugfix: RPC/Wallet: Include HD key metadata in dumpwallet by luke-jr)

    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.

  5. DrahtBot added the label Needs rebase on Sep 3, 2021
  6. theStack force-pushed on Sep 5, 2021
  7. DrahtBot removed the label Needs rebase on Sep 5, 2021
  8. DrahtBot added the label Needs rebase on Sep 30, 2021
  9. theStack force-pushed on Oct 2, 2021
  10. theStack commented at 9:14 PM on October 2, 2021: member

    Rebased on #22787 again (which in turn rebased on master recently).

  11. DrahtBot removed the label Needs rebase on Oct 2, 2021
  12. DrahtBot added the label Needs rebase on Oct 22, 2021
  13. theStack force-pushed on Oct 28, 2021
  14. theStack commented at 11:44 PM on October 28, 2021: member

    Rebased on #22787 again (which in turn rebased on master recently).

  15. DrahtBot removed the label Needs rebase on Oct 29, 2021
  16. laanwj commented at 4:08 PM on November 10, 2021: member

    Concept ACK, making const-wallet operations take const pointers is a good precaution.

    Code review ACK d150fe3ad5ce181511f2d2fd035a10530eaa4203

  17. refactor: avoid multiple key->metadata lookups in dumpwallet RPC
    This also enables working with a const ScriptPubKeyMan which was
    previously not possible due to std::map::operator[] not being const.
    29905c092f
  18. refactor: use const `LegacyScriptPubKeyMan` references in dump{privkey,wallet} RPCs ec2792d1dc
  19. refactor: use `CWallet` const shared pointers in dump{privkey,wallet} RPCs d150fe3ad5
  20. MarcoFalke commented at 4:15 PM on November 10, 2021: member

    Maybe rebase once more for fun?

  21. theStack force-pushed on Nov 10, 2021
  22. theStack commented at 4:25 PM on November 10, 2021: member

    Maybe rebase once more for fun?

    Done :upside_down_face:

  23. laanwj merged this on Nov 10, 2021
  24. laanwj closed this on Nov 10, 2021

  25. sidhujag referenced this in commit a5de714ef0 on Nov 10, 2021
  26. DrahtBot locked this on Nov 10, 2022

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 21:14 UTC

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