You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
51a3ac2 Have OutputGroup determine the value to use (Andrew Chow)
6d6d278 Change SelectCoins_test to actually test SelectCoins (Andrew Chow)
9d3bd74 Remove CreateTransaction while loop and some related variables (Andrew Chow)
6f0d518 Remove use_bnb and bnb_used (Andrew Chow)
de26eb0 Do both BnB and Knapsack coin selection in SelectCoinsMinConf (Andrew Chow)
01dc8eb Have KnapsackSolver actually use effective values (Andrew Chow)
bf26e01 Roll static tx fees into nValueToSelect instead of having it be separate (Andrew Chow)
cc3f14b Move output reductions for fee to after coin selection (Andrew Chow)
d97d25d Make cost_of_change part of CoinSelectionParams (Andrew Chow)
af5867c Move some calculations to common code in SelectCoinsMinConf (Andrew Chow)
1bf4a62 scripted-diff: rename some variables (Andrew Chow)
Pull request description:
Changes `KnapsackSolver` to use effective values instead of just the nominal txout value. Since fees are taken into account during the selection itself, we finally get rid of the `CreateTransaction` loop as well as a few other things that only were only necessary because of that loop.
This should not change coin selection behavior at all (except maybe remove weird edge cases that were caused by the loop). In order to keep behavior the same, `KnapsackSolver` will select outputs with a negative effective value (as it did before).
ACKs for top commit:
ryanofsky:
Code review ACK 51a3ac2. Looks good to go!
instagibbs:
review ACK bitcoin/bitcoin@51a3ac2
meshcollider:
re-light-utACK 51a3ac2
Tree-SHA512: 372c27e00edcd5dbf85177421ba88f20bfdaf1791b6e3dc022c44876ecc379403e2375ed69e71c512c49e6af87641001ff385c4b25ab93684b3a08a53bf3824e
if (curr_value + curr_available_value < actual_target || // Cannot possibly reach target with the amount remaining in the curr_available_value.
98
-
curr_value > actual_target + cost_of_change || // Selected value is out of range, go back and try other branch
94
+
if (curr_value + curr_available_value < selection_target || // Cannot possibly reach target with the amount remaining in the curr_available_value.
95
+
curr_value > selection_target + cost_of_change || // Selected value is out of range, go back and try other branch
99
96
(curr_waste > best_waste && (utxo_pool.at(0).fee - utxo_pool.at(0).long_term_fee) > 0)) { // Don't select things which we know will be more wasteful if the waste is increasing
100
97
backtrack = true;
101
-
} elseif (curr_value >= actual_target) { // Selected value is within range
102
-
curr_waste += (curr_value - actual_target); // This is the excess value which is added to the waste for the below comparison
98
+
} elseif (curr_value >= selection_target) { // Selected value is within range
99
+
curr_waste += (curr_value - selection_target); // This is the excess value which is added to the waste for the below comparison
103
100
// Adding another UTXO after this check could bring the waste down if the long term fee is higher than the current fee.
104
101
// However we are not going to explore that because this optimization for the waste is only done when we have hit our target
105
102
// value. Adding any more UTXOs will be just burning the UTXO; it will go entirely to fees. Thus we aren't going to
0 commit comments