[0.21] wallet: Avoid requesting fee rates multiple times during coin selection #21520

pull achow101 wants to merge 5 commits into bitcoin:0.21 from achow101:0.21-createtx-same-feerate changing 4 files +58 −34
  1. achow101 commented at 4:50 am on March 24, 2021: member
    Backport of #21083
  2. wallet: Use existing feerate instead of getting a new one
    During each loop of CreateTransaction, instead of constantly getting a
    new feerate, use the feerate that we have already fetched for all
    fee calculations. Thix fixes a race condition where the feerate required
    changes during each iteration of the loop.
    
    This commit changes behavior as the "Fee estimation failed" error will
    now take priority over "Signing transaction failed".
    
    Github-Pull: #21083
    Rebased-From: 1a6a0b0dfb90f9ebd4b86d7934c6aa5594974f5f
    48fc675163
  3. wallet: Replace nFeeRateNeeded with effective_fee
    Make sure that all fee calculations use the same feerate.
    coin_selection_params.effective_fee is the variable we use for all fee
    calculations, so get rid of remaining nFeeRateNeeded usages and just
    directly set coin_selection_params.effective_fee.
    
    Does not change behavior.
    
    Github-Pull: #21083
    Rebased-From: e2f429e6bbf7098f278c0247b954ecd3ba53cf37
    34c89f92f3
  4. wallet: Move long term feerate setting to CreateTransaction
    Instead of setting the long term feerate for each SelectCoinsMinConf
    iteration, set it once during CreateTransaction and let it be shared
    with each SelectCoinsMinConf through
    coin_selection_params.m_long_term_feerate.
    
    Does not change behavior.
    
    Github-Pull: #21083
    Rebased-From: 448d04b931f86941903e855f831249ff5ec77485
    bcd716670b
  5. wallet: Move discard feerate fetching to CreateTransaction
    Instead of fetching the discard feerate for each SelectCoinsMinConf
    iteration, fetch and cache it once during CreateTransaction so that it
    is shared for each SelectCoinsMinConf through
    coin_selection_params.m_discard_feerate.
    
    Does not change behavior.
    
    Github-Pull: #21083
    Rebased-From: bdd0c2934b7f389ffcfae3b602ee3ecee8581acd
    5fc381e443
  6. fanquake added the label Backport on Mar 24, 2021
  7. fanquake added this to the milestone 0.21.1 on Mar 24, 2021
  8. in src/wallet/test/coinselector_tests.cpp:300 in 4b7d19d456 outdated
    299@@ -300,7 +300,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
    300         CCoinControl coin_control;
    


    MarcoFalke commented at 11:54 am on April 1, 2021:
    Any reason to not rename in line 269?

    achow101 commented at 4:44 pm on April 1, 2021:
    Missed it when resolving conflicts. Done.
  9. MarcoFalke commented at 11:54 am on April 1, 2021: member

    cherry-pick-only ACK 4b7d19d456a3a1e54bc6f24d4b4e7e8f417896df 🐒

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3cherry-pick-only ACK 4b7d19d456a3a1e54bc6f24d4b4e7e8f417896df 🐒
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUil9wwAvjp9CweUIZcOEI6yjlm/XfbmPfpsNi20feQmD0jg/crBv4zwIRzdAY4L
     8zuzIhrJ9eG4ylMzQviuAtTS2UBx7BhQCBrMY3ZCNqZSS9m49zT/uhXdlXYXVacIG
     9prL/i1oL5J77jgxCrt3+zVC6XfO1BHXk8GgA2vWnIpI2MbNC3xS6ulZ2mbTosjsy
    10QlMv/0+H1qWLmK8Ce6t2S4EszyMHpsiatmIgJsLboIM1NpnwLPoXP7PFbJWW8wEx
    11eGe7yKd1UldUe6ryu9DOdcWsWNyZzHu9RHVlu5Q9UqUGF0CoXrdLQbC+kX1KcSE6
    12T0wMNdCN1udoDT3+uUxAtZJsBFbLKqQwhtZBvfHueZrVgAP5fIb9rABMvlBR2jOF
    13KGw287OdGzh46r/A+GC4sfZRRtol0gR9vr6TlfwU3m+tWO7LfO2YvdjQO6oX5YJS
    149m1o4i/f8PEcae1L3SSTiGpZ92mcvNolk3Q+Yr9JfEvaGTmH5m4Rj00zJ7lG4pNG
    15GpufZO4/
    16=kp7c
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash 03e63e4b18da74fc9ba5be4a98a589d33a69777e74b0004659c5bb473a8cb037 -

  10. Rename CoinSelectionParams::effective_fee to m_effective_feerate
    It's a feerate, not a fee. Also follow the style guide for member names.
    
    Github-Pull: #21083
    Rebased-From: f9cd2bfbccb7a2b8ff07cec5f6d2adbeca5f07c3
    d61fb07da7
  11. achow101 force-pushed on Apr 1, 2021
  12. MarcoFalke commented at 4:47 pm on April 1, 2021: member

    cherry-pick-only re-ACK d61fb07da7c12e4a1f68cf645f32d563a657a506 🔙

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3cherry-pick-only re-ACK d61fb07da7c12e4a1f68cf645f32d563a657a506 🔙
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUgBiwv+PHpjTYKRtUK3v9bYTZ2I0v6hzlydy0CNQAAm1XgJpy0moxairts8I8PL
     8Gi2dFUw7Utu/dFrucFjnr5SZjK7DyvehGnDSYuLjbNmQqinccmB02ulyrsheuGlT
     9izIpiku1EjqgBwYpyOg8qq8eAdQ/Ns9CJvnR+LUkXLhkkGr9YE44TcMDFCqJQKEb
    10y+g6V8J/zTnEnPiUmzeNYMVSTXhfROsblX3jFklb4AyjcvwqJExdq17vGq1aGQ3K
    11iC+vTmjaXzsliH+Y8x/MtRpf6Z3w8kEw09qGYD9lwSzFD6e0RhrbsEDePdhY/A+b
    12hv+Xtw25E4SFwpK88AOIhRowOzx6YdV9kO/o5VtaR6a0goqF8r9IF8GefJPzf6Z2
    13F5xo15FNz08k3sVpzwcaoZY275amIwVi51AoQwBSk4a0WmhQU/gbwFZ0x2puJ+uw
    142xUw6VqD3QjGMQA+IefHnfmCULH7iM9nrzMgnxLG9J5Q1aAmHAo0I4DlM8DKolDW
    15aRM7tnY3
    16=Wqy6
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash da605e100922a3feb0ef43fceeae52979a9cfa9e2e57a77c72f8deef904034d7 -

  13. fanquake requested review from fjahr on Apr 15, 2021
  14. fanquake requested review from meshcollider on Apr 15, 2021
  15. fanquake requested review from instagibbs on Apr 16, 2021
  16. fanquake merged this on Apr 16, 2021
  17. fanquake closed this on Apr 16, 2021

  18. fjahr commented at 10:21 pm on April 16, 2021: member
    Code review ACK d61fb07da7c12e4a1f68cf645f32d563a657a506
  19. DrahtBot locked this on Aug 16, 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: 2024-11-17 09:12 UTC

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