From 4e2efb3c5fde4b1e332cc032e3dc4082ec4e3cac Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 10 Oct 2015 14:49:38 +0200 Subject: tests: update transaction_tests for new dust threshold --- src/test/transaction_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test/transaction_tests.cpp') diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index 9847f6512..f9423bc0d 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -345,7 +345,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandard) t.vout[0].nValue = 501; // dust BOOST_CHECK(!IsStandardTx(t, reason)); - t.vout[0].nValue = 601; // not dust + t.vout[0].nValue = 2730; // not dust BOOST_CHECK(IsStandardTx(t, reason)); t.vout[0].scriptPubKey = CScript() << OP_1; -- cgit v1.2.3 From 5f46a7d0689ff1457b016fdf0de89e5153058864 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 13 Oct 2015 19:23:11 +0200 Subject: transaction_tests: Be more strict checking dust * Don't allow off-by-one or more * Make clear dust is coupled with minRelayTxFee * Check rounding for odd values --- src/test/transaction_tests.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/test/transaction_tests.cpp') diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index f9423bc0d..c840f4c9f 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -342,11 +342,26 @@ BOOST_AUTO_TEST_CASE(test_IsStandard) string reason; BOOST_CHECK(IsStandardTx(t, reason)); - t.vout[0].nValue = 501; // dust + // Check dust with default relay fee: + CAmount nDustThreshold = 182 * minRelayTxFee.GetFeePerK()/1000 * 3; + BOOST_CHECK_EQUAL(nDustThreshold, 546); + // dust: + t.vout[0].nValue = nDustThreshold - 1; BOOST_CHECK(!IsStandardTx(t, reason)); + // not dust: + t.vout[0].nValue = nDustThreshold; + BOOST_CHECK(IsStandardTx(t, reason)); - t.vout[0].nValue = 2730; // not dust + // Check dust with odd relay fee to verify rounding: + // nDustThreshold = 182 * 1234 / 1000 * 3 + minRelayTxFee = CFeeRate(1234); + // dust: + t.vout[0].nValue = 672 - 1; + BOOST_CHECK(!IsStandardTx(t, reason)); + // not dust: + t.vout[0].nValue = 672; BOOST_CHECK(IsStandardTx(t, reason)); + minRelayTxFee = CFeeRate(1000); t.vout[0].scriptPubKey = CScript() << OP_1; BOOST_CHECK(!IsStandardTx(t, reason)); -- cgit v1.2.3 From 536766c903c8dc84e6709e4bd387aad5acf8e433 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 27 Oct 2015 17:21:43 +0100 Subject: [trivial] New DEFAULT_MIN_RELAY_TX_FEE = 1000 --- src/test/transaction_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test/transaction_tests.cpp') diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index c840f4c9f..fb0df1aff 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -361,7 +361,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandard) // not dust: t.vout[0].nValue = 672; BOOST_CHECK(IsStandardTx(t, reason)); - minRelayTxFee = CFeeRate(1000); + minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE); t.vout[0].scriptPubKey = CScript() << OP_1; BOOST_CHECK(!IsStandardTx(t, reason)); -- cgit v1.2.3 From fa24439ff3d8ab5b9efaf66ef4dae6713b88cb35 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sun, 13 Dec 2015 17:58:29 +0100 Subject: Bump copyright headers to 2015 --- src/test/transaction_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test/transaction_tests.cpp') diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index fb0df1aff..3dca7ea0f 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin Core developers +// Copyright (c) 2011-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -- cgit v1.2.3