aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/coinselection.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2022-03-11 12:20:36 +0000
committerglozow <gloriajzhao@gmail.com>2022-03-11 12:22:34 +0000
commitec7d73628a6397fca3b5b852d4e97ff918b6d3a6 (patch)
tree2a71a2352f8b29cfa94eeb154e852033bd73488a /src/wallet/coinselection.cpp
parentce1fabe5454dfd01fe95b4a948704fcd3a155859 (diff)
downloadbitcoin-ec7d73628a6397fca3b5b852d4e97ff918b6d3a6.tar.xz
[wallet] assert BnB internally calculated waste is the same as GetSelectionWaste()
These two implementations of waste calculation should never deviate. Still keep the SelectCoinsBnB internal calculation because incremental calculate-as-you-go is much more performant than calling GetSelectionWaste() over and over again.
Diffstat (limited to 'src/wallet/coinselection.cpp')
-rw-r--r--src/wallet/coinselection.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wallet/coinselection.cpp b/src/wallet/coinselection.cpp
index 23faad027f..513572da45 100644
--- a/src/wallet/coinselection.cpp
+++ b/src/wallet/coinselection.cpp
@@ -163,6 +163,8 @@ std::optional<SelectionResult> SelectCoinsBnB(std::vector<OutputGroup>& utxo_poo
result.AddInput(utxo_pool.at(i));
}
}
+ result.ComputeAndSetWaste(CAmount{0});
+ assert(best_waste == result.GetWaste());
return result;
}