aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-01-02 17:59:54 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-01-02 18:06:52 +0100
commitf55c5e9749b4d010003d667421f0313e75372ddb (patch)
tree33157763bf245f55b947fdfb1001aae867e2f006 /src/test
parentc986972ad77242664c41c5e6fe07214e84aadd82 (diff)
parent012598880cf69a6a4d4d495c78e40ab4abb4eb39 (diff)
Merge pull request #5349
0125988 Implement test for merkle tree malleability in CPartialMerkleTree (Pieter Wuille)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/pmt_tests.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/pmt_tests.cpp b/src/test/pmt_tests.cpp
index 807a5d1e5f..56e0541664 100644
--- a/src/test/pmt_tests.cpp
+++ b/src/test/pmt_tests.cpp
@@ -10,6 +10,7 @@
#include <vector>
+#include <boost/assign/list_of.hpp>
#include <boost/test/unit_test.hpp>
using namespace std;
@@ -104,4 +105,14 @@ BOOST_AUTO_TEST_CASE(pmt_test1)
}
}
+BOOST_AUTO_TEST_CASE(pmt_malleability)
+{
+ std::vector<uint256> vTxid = boost::assign::list_of(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(9)(10);
+ std::vector<bool> vMatch = boost::assign::list_of(false)(false)(false)(false)(false)(false)(false)(false)(false)(true)(true)(false);
+
+ CPartialMerkleTree tree(vTxid, vMatch);
+ std::vector<uint256> vTxid2;
+ BOOST_CHECK(tree.ExtractMatches(vTxid) == 0);
+}
+
BOOST_AUTO_TEST_SUITE_END()