diff options
author | Jim Posen <jim.posen@gmail.com> | 2018-08-26 11:25:36 -0700 |
---|---|---|
committer | Jim Posen <jim.posen@gmail.com> | 2018-08-28 12:12:32 -0700 |
commit | f05599557a8305d16bd5965921583af9d012fc27 (patch) | |
tree | c321cfe6df4cb8dde1c35938c3a11429f7ad09c7 /src/test/blockfilter_tests.cpp | |
parent | 427253cf7e19ed9ef86b45457de41e345676c88e (diff) | |
download | bitcoin-f05599557a8305d16bd5965921583af9d012fc27.tar.xz |
blockfilter: Omit empty scripts from filter contents.
Code change also avoids out-of-bounds script access bug.
Diffstat (limited to 'src/test/blockfilter_tests.cpp')
-rw-r--r-- | src/test/blockfilter_tests.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/test/blockfilter_tests.cpp b/src/test/blockfilter_tests.cpp index e3cb05f09e..773de343ea 100644 --- a/src/test/blockfilter_tests.cpp +++ b/src/test/blockfilter_tests.cpp @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(gcsfilter_test) BOOST_AUTO_TEST_CASE(blockfilter_basic_test) { - CScript included_scripts[5], excluded_scripts[2]; + CScript included_scripts[5], excluded_scripts[3]; // First two are outputs on a single transaction. included_scripts[0] << std::vector<unsigned char>(0, 65) << OP_CHECKSIG; @@ -67,6 +67,7 @@ BOOST_AUTO_TEST_CASE(blockfilter_basic_test) CMutableTransaction tx_2; tx_2.vout.emplace_back(300, included_scripts[2]); tx_2.vout.emplace_back(0, excluded_scripts[0]); + tx_2.vout.emplace_back(400, excluded_scripts[2]); // Script is empty CBlock block; block.vtx.push_back(MakeTransactionRef(tx_1)); @@ -74,8 +75,9 @@ BOOST_AUTO_TEST_CASE(blockfilter_basic_test) CBlockUndo block_undo; block_undo.vtxundo.emplace_back(); - block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(400, included_scripts[3]), 1000, true); - block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(500, included_scripts[4]), 10000, false); + block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(500, included_scripts[3]), 1000, true); + block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(600, included_scripts[4]), 10000, false); + block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(700, excluded_scripts[2]), 100000, false); BlockFilter block_filter(BlockFilterType::BASIC, block, block_undo); const GCSFilter& filter = block_filter.GetFilter(); |