-
Notifications
You must be signed in to change notification settings - Fork 38.8k
refactor: use CWallet const shared pointers in dump{privkey,wallet} #22805
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
refactor: use CWallet const shared pointers in dump{privkey,wallet} #22805
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
95c1235 to
89880e8
Compare
89880e8 to
6896044
Compare
|
Rebased on #22787 again (which in turn rebased on master recently). |
6896044 to
199d1b3
Compare
|
Rebased on #22787 again (which in turn rebased on master recently). |
|
Concept ACK, making const-wallet operations take const pointers is a good precaution. Code review ACK d150fe3 |
This also enables working with a const ScriptPubKeyMan which was previously not possible due to std::map::operator[] not being const.
|
Maybe rebase once more for fun? |
199d1b3 to
d150fe3
Compare
Done 🙃 |
…ump{privkey,wallet}
d150fe3 refactor: use `CWallet` const shared pointers in dump{privkey,wallet} RPCs (Sebastian Falbesoner)
ec2792d refactor: use const `LegacyScriptPubKeyMan` references in dump{privkey,wallet} RPCs (Sebastian Falbesoner)
29905c0 refactor: avoid multiple key->metadata lookups in dumpwallet RPC (Sebastian Falbesoner)
Pull request description:
~~This PR is based on bitcoin#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.
ACKs for top commit:
laanwj:
Code review ACK d150fe3
Tree-SHA512: 90ac05e21f40c6d0ebb479a71c545da2fd89940b9ca3409d9f932abc983bf8830d34c45086e68880d0d1e994846fbefee7534eec142ff4268e0fa28a1a411d36
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
dumpprivkeyanddumpwalletRPC methods. For doing that, some more preparations are needed; we need a const-counterpart to the helperEnsureLegacyScriptPubKeyManthat accepts a const CWallet pointer and accordingly also returns a constLegacyScriptPubKeyManinstance. The metadata lookup indumpwalletis changed to not need a mutableScriptPubKeyManinstance by avoiding using theoperator[]in its mapKeyMetadata map, which also avoids repeated lookups.