aboutsummaryrefslogtreecommitdiff
path: root/src/test/transaction_tests.cpp
diff options
context:
space:
mode:
authorDominik Spicher <dominik.spicher@inacta.ch>2019-11-21 21:09:32 +0100
committerDominik Spicher <dominik.spicher@inacta.ch>2019-11-21 21:30:01 +0100
commit76303f65f92a0fbe9a90c0e807554a6daa860636 (patch)
tree5410b648915a14e18f56c1660f24ec1e53f10fa8 /src/test/transaction_tests.cpp
parentae6943620ab369e8e0865c3ec2d2848ba9389325 (diff)
test: add unit test for non-standard txs with wrong nVersion
Diffstat (limited to 'src/test/transaction_tests.cpp')
-rw-r--r--src/test/transaction_tests.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index eb0050a4a3..2f7a3132d8 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -713,6 +713,29 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
t.vout[0].nValue = nDustThreshold;
BOOST_CHECK(IsStandardTx(CTransaction(t), reason));
+ // Disallowed nVersion
+ t.nVersion = -1;
+ reason.clear();
+ BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
+ BOOST_CHECK_EQUAL(reason, "version");
+
+ t.nVersion = 0;
+ reason.clear();
+ BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
+ BOOST_CHECK_EQUAL(reason, "version");
+
+ t.nVersion = 3;
+ reason.clear();
+ BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
+ BOOST_CHECK_EQUAL(reason, "version");
+
+ // Allowed nVersion
+ t.nVersion = 1;
+ BOOST_CHECK(IsStandardTx(CTransaction(t), reason));
+
+ t.nVersion = 2;
+ BOOST_CHECK(IsStandardTx(CTransaction(t), reason));
+
// Check dust with odd relay fee to verify rounding:
// nDustThreshold = 182 * 3702 / 1000
dustRelayFee = CFeeRate(3702);