Changeset View
Changeset View
Standalone View
Standalone View
src/test/txindex_tests.cpp
// Copyright (c) 2017-2018 The Bitcoin Core developers | // Copyright (c) 2017-2018 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <index/txindex.h> | #include <index/txindex.h> | ||||
#include <script/standard.h> | #include <script/standard.h> | ||||
#include <test/test_bitcoin.h> | #include <test/test_bitcoin.h> | ||||
#include <util.h> | #include <util.h> | ||||
#include <utiltime.h> | #include <utiltime.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
BOOST_AUTO_TEST_SUITE(txindex_tests) | BOOST_AUTO_TEST_SUITE(txindex_tests) | ||||
BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup) { | BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup) { | ||||
TxIndex txindex(std::make_unique<TxIndexDB>(1 << 20, true)); | TxIndex txindex(1 << 20, true); | ||||
CTransactionRef tx_disk; | CTransactionRef tx_disk; | ||||
uint256 block_hash; | uint256 block_hash; | ||||
// Transaction should not be found in the index before it is started. | // Transaction should not be found in the index before it is started. | ||||
for (const auto &txn : coinbaseTxns) { | for (const auto &txn : coinbaseTxns) { | ||||
BOOST_CHECK(!txindex.FindTx(txn.GetHash(), block_hash, tx_disk)); | BOOST_CHECK(!txindex.FindTx(txn.GetHash(), block_hash, tx_disk)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |