diff options
| author | Jim Posen <[email protected]> | 2019-10-14 22:03:51 +0200 |
|---|---|---|
| committer | Jim Posen <[email protected]> | 2019-10-14 22:04:19 +0200 |
| commit | f59bbb61af5055844c16939a4f8e58c4f73843c1 (patch) | |
| tree | 128752863755fbabf4c46c0f57f3bfc55baebc76 /src | |
| parent | Merge #17124: test: speed up wallet_address_types by whitelisting peers (imme... (diff) | |
| download | discoin-f59bbb61af5055844c16939a4f8e58c4f73843c1.tar.xz discoin-f59bbb61af5055844c16939a4f8e58c4f73843c1.zip | |
test: Fix bug in blockfilter_index_tests.
The test case tests a chain reorganization, however the two
chains were generated in the same manner and thus produced
the same blocks.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/blockfilter_index_tests.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/test/blockfilter_index_tests.cpp b/src/test/blockfilter_index_tests.cpp index cf87aa930..ba293b783 100644 --- a/src/test/blockfilter_index_tests.cpp +++ b/src/test/blockfilter_index_tests.cpp @@ -167,17 +167,23 @@ BOOST_FIXTURE_TEST_CASE(blockfilter_index_initial_sync, TestChain100Setup) LOCK(cs_main); tip = ::ChainActive().Tip(); } - CScript coinbase_script_pub_key = GetScriptForDestination(PKHash(coinbaseKey.GetPubKey())); + CKey coinbase_key_A, coinbase_key_B; + coinbase_key_A.MakeNewKey(true); + coinbase_key_B.MakeNewKey(true); + CScript coinbase_script_pub_key_A = GetScriptForDestination(PKHash(coinbase_key_A.GetPubKey())); + CScript coinbase_script_pub_key_B = GetScriptForDestination(PKHash(coinbase_key_B.GetPubKey())); std::vector<std::shared_ptr<CBlock>> chainA, chainB; - BOOST_REQUIRE(BuildChain(tip, coinbase_script_pub_key, 10, chainA)); - BOOST_REQUIRE(BuildChain(tip, coinbase_script_pub_key, 10, chainB)); + BOOST_REQUIRE(BuildChain(tip, coinbase_script_pub_key_A, 10, chainA)); + BOOST_REQUIRE(BuildChain(tip, coinbase_script_pub_key_B, 10, chainB)); // Check that new blocks on chain A get indexed. uint256 chainA_last_header = last_header; for (size_t i = 0; i < 2; i++) { const auto& block = chainA[i]; BOOST_REQUIRE(ProcessNewBlock(Params(), block, true, nullptr)); - + } + for (size_t i = 0; i < 2; i++) { + const auto& block = chainA[i]; const CBlockIndex* block_index; { LOCK(cs_main); @@ -193,7 +199,9 @@ BOOST_FIXTURE_TEST_CASE(blockfilter_index_initial_sync, TestChain100Setup) for (size_t i = 0; i < 3; i++) { const auto& block = chainB[i]; BOOST_REQUIRE(ProcessNewBlock(Params(), block, true, nullptr)); - + } + for (size_t i = 0; i < 3; i++) { + const auto& block = chainB[i]; const CBlockIndex* block_index; { LOCK(cs_main); @@ -221,7 +229,7 @@ BOOST_FIXTURE_TEST_CASE(blockfilter_index_initial_sync, TestChain100Setup) // Reorg back to chain A. for (size_t i = 2; i < 4; i++) { const auto& block = chainA[i]; - BOOST_REQUIRE(ProcessNewBlock(Params(), block, true, nullptr)); + BOOST_REQUIRE(ProcessNewBlock(Params(), block, true, nullptr)); } // Check that chain A and B blocks can be retrieved. |