diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-10-29 10:52:30 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-10-29 10:52:37 +0200 |
commit | baa9fc941cac76b35630da16d77fa2a8b0cc1755 (patch) | |
tree | fa0980f2dc1c5d37966546cc723f42ecebc1f049 /src/wallet/wallet.h | |
parent | ab25ef8c7f767258d5fe44f53b35ad8bd51ed5cd (diff) | |
parent | 54011e7aa274bdc1b921440cc8b4623aa1e0d89e (diff) |
Merge bitcoin/bitcoin#22787: refactor: actual immutable pointing
54011e7aa274bdc1b921440cc8b4623aa1e0d89e refactor: use CWallet const shared pointers when possible (Karl-Johan Alm)
96461989a2de737151bc4fb216221bf49cb53ce6 refactor: const shared_ptrs (Karl-Johan Alm)
Pull request description:
```C++
const std::shared_ptr<CWallet> wallet = x;
```
means we can not do `wallet = y`, but we can totally do `wallet->DestructiveOperation()`, contrary to what that line looks like.
This PR
* introduces a new convention: always use const shared pointers to `CWallet`s (even when we mutate the pointed-to thing)
* uses `const shared_ptr<const CWallet>` everywhere where wallets are not modified
In the future, this should preferably apply to all shared pointers, not limited to just `CWallet`s.
Both of these serve the same purpose: to dispell the misconception that `const shared_ptr<X>` immutates `X`. It doesn't, and it's dangerous to leave this misconception as is, for obvious reasons.
ACKs for top commit:
theStack:
re-ACK 54011e7aa274bdc1b921440cc8b4623aa1e0d89e
Tree-SHA512: 3bf4062fc821751be30770c6b4ead10a016847970f155a0a5156f304347d221b9830840030c2fbfba8cd1e282f4eda45f5b4107fe6df8138afdcb6c2e95a2836
Diffstat (limited to 'src/wallet/wallet.h')
0 files changed, 0 insertions, 0 deletions