aboutsummaryrefslogtreecommitdiff
path: root/src/test/transaction_tests.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2016-01-15 05:17:15 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2016-01-15 05:17:15 +0000
commit5bc4fb7b602c420be1c746442edad6b2d8e333ab (patch)
tree32ce1458f7fafdf4f9a1dcb09091f1a6de416625 /src/test/transaction_tests.cpp
parente8600c924d58f3ef0450fc269998452e5b17aecb (diff)
parentc079d79c9a9c726fff367abc2d21c528e37275b9 (diff)
downloadbitcoin-5bc4fb7b602c420be1c746442edad6b2d8e333ab.tar.xz
Merge branch 'master' into 20150703_banlist_updates
Diffstat (limited to 'src/test/transaction_tests.cpp')
-rw-r--r--src/test/transaction_tests.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index 9847f6512e..3dca7ea0f7 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.
@@ -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 = 601; // 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(DEFAULT_MIN_RELAY_TX_FEE);
t.vout[0].scriptPubKey = CScript() << OP_1;
BOOST_CHECK(!IsStandardTx(t, reason));