refactor: Drop CCoinControl::SetNull #21714

pull promag wants to merge 1 commits into bitcoin:master from promag:2021-04-coincontrol changing 3 files +13 −31
  1. promag commented at 1:02 AM on April 17, 2021: member

    The only external call to SetNull is changed as follow

    - m_coin_control->SetNull();
    + m_coin_control = std::make_unique<CCoinControl>();
    
  2. DrahtBot added the label GUI on Apr 17, 2021
  3. DrahtBot added the label Refactoring on Apr 17, 2021
  4. DrahtBot added the label Wallet on Apr 17, 2021
  5. MarcoFalke removed the label GUI on Apr 17, 2021
  6. practicalswift commented at 7:35 AM on April 17, 2021: contributor

    Concept ACK: default member initialisation is simply better. Thanks for cleaning this up.

    The only external call to SetNull is changed as follow

    - m_coin_control->SetNull();
    + m_coin_control.reset(new CCoinControl);
    

    Could be made more idiomatic as m_coin_control = std::make_unique<CCoinControl>()?

    Rationale:

  7. in src/wallet/coincontrol.cpp:11 in 5b428548b5 outdated
       5 | @@ -6,21 +6,8 @@
       6 |  
       7 |  #include <util/system.h>
       8 |  
       9 | -void CCoinControl::SetNull()
      10 | +CCoinControl::CCoinControl()
      11 |  {
      12 |      destChange = CNoDestination();
    


    practicalswift commented at 7:39 AM on April 17, 2021:

    descChange could be default initialized like the other member variables?

  8. in src/wallet/coincontrol.h:45 in 5b428548b5 outdated
      43 | @@ -44,20 +44,15 @@ class CCoinControl
      44 |      //! Avoid partial use of funds sent to a given address
      45 |      bool m_avoid_partial_spends;
    


    practicalswift commented at 7:42 AM on April 17, 2021:

    Could be default initialised to DEFAULT_AVOIDPARTIALSPENDS?


    MarcoFalke commented at 8:02 AM on April 17, 2021:

    or made const, which also avoids uninitialized reads


    promag commented at 8:31 AM on April 17, 2021:

    It's changed in wallet.cpp.


    promag commented at 8:55 AM on April 17, 2021:

    Initialised to DEFAULT_AVOIDPARTIALSPENDS.

  9. practicalswift changes_requested
  10. promag force-pushed on Apr 17, 2021
  11. promag force-pushed on Apr 17, 2021
  12. DrahtBot commented at 10:27 AM on April 17, 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:

    • #21359 (rpc: include_unsafe option for fundrawtransaction by t-bast)
    • #17211 (Allow fundrawtransaction and walletcreatefundedpsbt to take external inputs by achow101)

    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. theStack commented at 3:24 PM on April 18, 2021: member

    Concept ACK

    Some suggestions:

    • I'd not change the assignment to m_coin_control twice, but rather set it to the suggested form m_coin_control = std::make_unique<CCoinControl>(); in the first commit already
    • A short mention about the second refactoring commit (which seems to be independent) in the PR description would be helpful for reviewers
  14. refactor: Drop CCoinControl::SetNull c5a470eee1
  15. promag force-pushed on Apr 18, 2021
  16. promag commented at 8:17 PM on April 18, 2021: member

    @theStack thanks, fixed 1st commit and moved the 2nd to https://github.com/bitcoin-core/gui/pull/284.

  17. theStack approved
  18. theStack commented at 12:01 AM on April 20, 2021: member

    Code-Review ACK c5a470eee1ac864b7c02b6a1669327b68411d806

  19. MarcoFalke commented at 7:20 AM on April 26, 2021: member

    review ACK c5a470eee1ac864b7c02b6a1669327b68411d806 🍤

    <details><summary>Show signature and timestamp</summary>

    Signature:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    review ACK c5a470eee1ac864b7c02b6a1669327b68411d806 🍤
    -----BEGIN PGP SIGNATURE-----
    
    iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
    pUjEBQv9Hyhwk4wiG0CE/cprRuXgoATy0MDrJI2ii4SfyRpkyQUWUUwJDqJ32u7g
    90CiAI8F9/YOraKKlQ/0C8UvpoSldXQoPO8R9BPMZ0bN071w4P0veGQJC6HSodYb
    tWUMaHRY4CfcNLwQs+9a67k2jMARYazkpthSpJDd9bHjncAnjOxS1mlPprVucRFt
    hyK3nvHafk7i+RE9qvikAd4N6bBccDQ113qB6sdrMuc8a1cy7zyebnc8UnsR1ycU
    qMmr3Uw6JrUeSgPy45XjA8Qg/0FgyTl9XzqyuLkfritbba44ruiAliKNkKaN8/zJ
    r43TkSAh+qWT27KirL2hUvC5SHutL2W5qe0PD6L/ELo+jsTC6feTvxDkquq28/8D
    eAteFrKnXSbztnvKzCRGQgWRjD5NcXNNrL9cDpy773u6ry6x0hW/NcLWyhasKF3x
    QarYEFR0YgmYvJeOzRJk6ZulylZz9cLhIFzZznkhPTfnw3Fk2P3px505TZXSzEaM
    KqFm03/a
    =WFww
    -----END PGP SIGNATURE-----
    

    Timestamp of file with hash 226895addc7c0ac26f721c2093209f0d6c180e2ba9db87fb2e6db52dc99831da -

    </details>

  20. MarcoFalke merged this on Apr 26, 2021
  21. MarcoFalke closed this on Apr 26, 2021

  22. promag deleted the branch on Apr 26, 2021
  23. sidhujag referenced this in commit 69cc74a4f7 on Apr 26, 2021
  24. gwillen referenced this in commit ff1af2ca5d on Jun 1, 2022
  25. DrahtBot locked this on Aug 18, 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-21 15:14 UTC

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