-
Notifications
You must be signed in to change notification settings - Fork 38.8k
wallet: replace raw pointer with const reference in AddrToPubKey #17584
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
wallet: replace raw pointer with const reference in AddrToPubKey #17584
Conversation
|
Concept ACK |
|
Any idea why it was a pointer in the first place? Always happy to get rid of pointers. concept ACK |
|
The pointer argument was introduced in 1df206f. Maybe @achow101 remembers? At that time the However at that time all callers of So maybe it was due to some code mimicing? Other callers of Concept ACK |
More like code copying. Concept ACK |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 1a3a256.
hebasto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 1a3a256, I have not tested the code, but I have reviewed it and it looks OK, I agree it can be merged.
|
ACK 1a3a256 |
|
utACK 1a3a256 |
…rToPubKey 1a3a256 wallet: replace raw pointer with const reference in AddrToPubKey (Harris) Pull request description: This PR replaces a redundant reference-to-pointer conversion in **addmultisigaddress** from *wallet/rpcwallet.cpp*. It also makes the API from *rpc/util.h* look more straightforward as **AddrToPubKey** now uses const references like other functions from there. I am not sure why there is a ref-to-ptr conversion in addmultisignatures, so I can only speculate that this is because of "historical reasons". The ref-to-ptr conversion happens here: https://github.com/bitcoin/bitcoin/blob/master/src/wallet/rpcwallet.cpp#L1001 There, the address of LegacyScriptPubKeyMan& is given to AddrToPubKey. Later, in AddrToPubKey, it gets converted back to a reference, because GetKeyForDestination in rpc/util.cpp expects a const ref: https://github.com/bitcoin/bitcoin/blob/master/src/rpc/util.cpp#L140 Regards, ACKs for top commit: achow101: ACK 1a3a256 meshcollider: utACK 1a3a256 promag: Code review ACK 1a3a256. hebasto: ACK 1a3a256, I have not tested the code, but I have reviewed it and it looks OK, I agree it can be merged. Tree-SHA512: 1a2b8ddab5694ef4c65fac69f011e38dd03a634e84a35857e13bd05ad99fe42af22ee0af6230865e3d2c725693512f3336acb055ede19c958424283e7a3856c4
… in AddrToPubKey 1a3a256 wallet: replace raw pointer with const reference in AddrToPubKey (Harris) Pull request description: This PR replaces a redundant reference-to-pointer conversion in **addmultisigaddress** from *wallet/rpcwallet.cpp*. It also makes the API from *rpc/util.h* look more straightforward as **AddrToPubKey** now uses const references like other functions from there. I am not sure why there is a ref-to-ptr conversion in addmultisignatures, so I can only speculate that this is because of "historical reasons". The ref-to-ptr conversion happens here: https://github.com/bitcoin/bitcoin/blob/master/src/wallet/rpcwallet.cpp#L1001 There, the address of LegacyScriptPubKeyMan& is given to AddrToPubKey. Later, in AddrToPubKey, it gets converted back to a reference, because GetKeyForDestination in rpc/util.cpp expects a const ref: https://github.com/bitcoin/bitcoin/blob/master/src/rpc/util.cpp#L140 Regards, ACKs for top commit: achow101: ACK 1a3a256 meshcollider: utACK 1a3a256 promag: Code review ACK 1a3a256. hebasto: ACK 1a3a256, I have not tested the code, but I have reviewed it and it looks OK, I agree it can be merged. Tree-SHA512: 1a2b8ddab5694ef4c65fac69f011e38dd03a634e84a35857e13bd05ad99fe42af22ee0af6230865e3d2c725693512f3336acb055ede19c958424283e7a3856c4
…AddrToPubKey Summary: 1a3a256d5e0443d19757c1f1fceb9c9ede17758a wallet: replace raw pointer with const reference in AddrToPubKey (Harris) Pull request description: This PR replaces a redundant reference-to-pointer conversion in **addmultisigaddress** from *wallet/rpcwallet.cpp*. It also makes the API from *rpc/util.h* look more straightforward as **AddrToPubKey** now uses const references like other functions from there. I am not sure why there is a ref-to-ptr conversion in addmultisignatures, so I can only speculate that this is because of "historical reasons". The ref-to-ptr conversion happens here: https://github.com/bitcoin/bitcoin/blob/master/src/wallet/rpcwallet.cpp#L1001 There, the address of LegacyScriptPubKeyMan& is given to AddrToPubKey. Later, in AddrToPubKey, it gets converted back to a reference, because GetKeyForDestination in rpc/util.cpp expects a const ref: https://github.com/bitcoin/bitcoin/blob/master/src/rpc/util.cpp#L140 Regards, --- Backport of Core [[bitcoin/bitcoin#17584 | PR17584]] Test Plan: ninja all check check-functional Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D7715
… in AddrToPubKey 1a3a256 wallet: replace raw pointer with const reference in AddrToPubKey (Harris) Pull request description: This PR replaces a redundant reference-to-pointer conversion in **addmultisigaddress** from *wallet/rpcwallet.cpp*. It also makes the API from *rpc/util.h* look more straightforward as **AddrToPubKey** now uses const references like other functions from there. I am not sure why there is a ref-to-ptr conversion in addmultisignatures, so I can only speculate that this is because of "historical reasons". The ref-to-ptr conversion happens here: https://github.com/bitcoin/bitcoin/blob/master/src/wallet/rpcwallet.cpp#L1001 There, the address of LegacyScriptPubKeyMan& is given to AddrToPubKey. Later, in AddrToPubKey, it gets converted back to a reference, because GetKeyForDestination in rpc/util.cpp expects a const ref: https://github.com/bitcoin/bitcoin/blob/master/src/rpc/util.cpp#L140 Regards, ACKs for top commit: achow101: ACK 1a3a256 meshcollider: utACK 1a3a256 promag: Code review ACK 1a3a256. hebasto: ACK 1a3a256, I have not tested the code, but I have reviewed it and it looks OK, I agree it can be merged. Tree-SHA512: 1a2b8ddab5694ef4c65fac69f011e38dd03a634e84a35857e13bd05ad99fe42af22ee0af6230865e3d2c725693512f3336acb055ede19c958424283e7a3856c4
This PR replaces a redundant reference-to-pointer conversion in addmultisigaddress from wallet/rpcwallet.cpp. It also makes the API from rpc/util.h look more straightforward as AddrToPubKey now uses const references like other functions from there.
I am not sure why there is a ref-to-ptr conversion in addmultisignatures, so I can only speculate that this is because of "historical reasons".
The ref-to-ptr conversion happens here: https://github.com/bitcoin/bitcoin/blob/master/src/wallet/rpcwallet.cpp#L1001
There, the address of LegacyScriptPubKeyMan& is given to AddrToPubKey.
Later, in AddrToPubKey, it gets converted back to a reference, because GetKeyForDestination in rpc/util.cpp expects a const ref: https://github.com/bitcoin/bitcoin/blob/master/src/rpc/util.cpp#L140
Regards,