aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/test/wallet_tests.cpp
diff options
context:
space:
mode:
authorRoss Nicoll <[email protected]>2021-08-05 22:21:53 +0100
committerGitHub <[email protected]>2021-08-05 22:21:53 +0100
commit5db95e5a5f48eb76601946ea670ee3b2a33e2a4b (patch)
tree601ebf9d1837710dffdb5ff9b96e8acd903a4a9a /src/wallet/test/wallet_tests.cpp
parentMerge pull request #2415 from rnicoll/1.14.4-rbf-fee (diff)
parent[fees] Express policies in COIN instead of Koinu (diff)
downloaddiscoin-5db95e5a5f48eb76601946ea670ee3b2a33e2a4b.tar.xz
discoin-5db95e5a5f48eb76601946ea670ee3b2a33e2a4b.zip
Merge pull request #2348 from patricklodder/1.14-cfg-dust-limit
[fees] introduce configurable hard dust limit
Diffstat (limited to 'src/wallet/test/wallet_tests.cpp')
-rw-r--r--src/wallet/test/wallet_tests.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
index 4e84bb688..79a994bf6 100644
--- a/src/wallet/test/wallet_tests.cpp
+++ b/src/wallet/test/wallet_tests.cpp
@@ -36,6 +36,8 @@ std::vector<std::unique_ptr<CWalletTx>> wtxn;
typedef set<pair<const CWalletTx*,unsigned int> > CoinSet;
+extern unsigned int nDustLimit;
+
BOOST_FIXTURE_TEST_SUITE(wallet_tests, WalletTestingSetup)
static const CWallet wallet;
@@ -524,6 +526,18 @@ BOOST_AUTO_TEST_CASE(GetMinimumFee_dust_test)
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 963, 0, pool), 2 * nMinTxFee);
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1000, 0, pool), 2 * nMinTxFee);
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1999, 0, pool), 3 * nMinTxFee);
+
+ // change the hard dust limit
+
+ nDustLimit = COIN / 10;
+
+ // Confirm dust penalty fees are not added
+
+ BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 963, 0, pool), 1 * nMinTxFee);
+ BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1000, 0, pool), 1 * nMinTxFee);
+ BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1999, 0, pool), 2 * nMinTxFee);
+
+ nDustLimit = COIN;
}
BOOST_AUTO_TEST_SUITE_END()