aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2016-01-05 00:38:12 +0100
committerMarcoFalke <falke.marco@gmail.com>2016-01-05 00:40:20 +0100
commitfa3c7e644f427329bcffa1a5600fdbd7e97c837f (patch)
treea0017e315091040dae054577cc3dc14d9fdb979d /src/wallet
parentfafd09375eb5133abf921132643384a1ac6fa444 (diff)
[wallet] Add regression test for vValue sort order
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/test/wallet_tests.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
index ee4f228a0a..a13893127d 100644
--- a/src/wallet/test/wallet_tests.cpp
+++ b/src/wallet/test/wallet_tests.cpp
@@ -328,6 +328,24 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests)
empty_wallet();
}
+BOOST_AUTO_TEST_CASE(sorting_in_ApproximateBestSet)
+{
+ CoinSet setCoinsRet;
+ CAmount nValueRet;
+
+ LOCK(wallet.cs_wallet);
+
+ empty_wallet();
+
+ for (int i = 0; i < 1000; i++)
+ add_coin(1000 * COIN);
+ add_coin(3 * COIN);
+
+ BOOST_CHECK(wallet.SelectCoinsMinConf(1003 * COIN, 1, 6, vCoins, setCoinsRet, nValueRet));
+ BOOST_CHECK_EQUAL(nValueRet, 1003 * COIN);
+ BOOST_CHECK_EQUAL(setCoinsRet.size(), 2U);
+}
+
BOOST_AUTO_TEST_CASE(pruning_in_ApproximateBestSet)
{
CoinSet setCoinsRet;