diff options
author | AlSzacrel <alszacrel@web.de> | 2014-09-13 02:09:18 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-12-08 10:25:58 +0100 |
commit | 96e8d120336cf4312cd5f42ba2f9aff17d4ad414 (patch) | |
tree | 9b2702948b636f36f5472dac8519771ac265ee2a /src/wallet/test/wallet_tests.cpp | |
parent | b2d7ada3727f026ccd83d3d64c75aab660d8053e (diff) |
Coinselection prunes extraneous inputs from ApproximateBestSubset
This is a combination of 3 commits.
- Coinselection prunes extraneous inputs from ApproximateBestSubset
A further pass over the available inputs has been added to ApproximateBestSubset after a candidate set has been found. It will prune any extraneous inputs in the selected subset, in order to decrease the number of input and the resulting change.
- Moved set reduction to the end of ApproximateBestSubset to reduce performance impact
- Added a test for the pruning of extraneous inputs after ApproximateBestSet
Github-Pull: #4906
Rebased-From: 5c03483e26ab414d22ef192691b2336c1bb3cb02 af9510e0374443b093d633a91c4f1f8bf5071292 fc0f52d78085b6ef97d6821fc7592326c2d9b495
Diffstat (limited to 'src/wallet/test/wallet_tests.cpp')
-rw-r--r-- | src/wallet/test/wallet_tests.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index 8b9292bd14..5e8ccd90ab 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -328,4 +328,22 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests) empty_wallet(); } +BOOST_AUTO_TEST_CASE(pruning_in_ApproximateBestSet) +{ + CoinSet setCoinsRet; + CAmount nValueRet; + + LOCK(wallet.cs_wallet); + + empty_wallet(); + for (int i = 0; i < 12; i++) + { + add_coin(10*CENT); + } + add_coin(100*CENT); + add_coin(100*CENT); + BOOST_CHECK(wallet.SelectCoinsMinConf(221*CENT, 1, 6, vCoins, setCoinsRet, nValueRet)); + BOOST_CHECK_EQUAL(nValueRet, 230*CENT); +} + BOOST_AUTO_TEST_SUITE_END() |