 |
Bitcoin Core
22.99.0
P2P Digital Currency
|
Go to the documentation of this file.
10 #include <validation.h>
12 #include <boost/test/unit_test.hpp>
24 for (
const auto& txn : m_coinbase_txns) {
29 BOOST_CHECK(!txindex.BlockUntilSyncedToCurrentChain());
34 constexpr int64_t timeout_ms = 10 * 1000;
36 while (!txindex.BlockUntilSyncedToCurrentChain()) {
43 for (
const auto& txn : genesis_block.
vtx) {
48 for (
const auto& txn : m_coinbase_txns) {
49 if (!txindex.
FindTx(txn->GetHash(), block_hash, tx_disk)) {
50 BOOST_ERROR(
"FindTx failed");
51 }
else if (tx_disk->GetHash() != txn->GetHash()) {
52 BOOST_ERROR(
"Read incorrect tx");
57 for (
int i = 0; i < 10; i++) {
59 std::vector<CMutableTransaction> no_txns;
60 const CBlock& block = CreateAndProcessBlock(no_txns, coinbase_script_pub_key);
63 BOOST_CHECK(txindex.BlockUntilSyncedToCurrentChain());
65 BOOST_ERROR(
"FindTx failed");
66 }
else if (tx_disk->GetHash() != txn.
GetHash()) {
67 BOOST_ERROR(
"Read incorrect tx");
BOOST_AUTO_TEST_SUITE(cuckoocache_tests)
Test Suite for CuckooCache.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup)
std::shared_ptr< const CTransaction > CTransactionRef
BOOST_AUTO_TEST_SUITE_END()
The basic transaction that is broadcasted on the network and contained in blocks.
void SyncWithValidationInterfaceQueue()
This is a synonym for the following, which asserts certain locks are not held: std::promise<void> pro...
void Stop()
Stops the instance from staying in sync with blockchain updates.
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
const CBlock & GenesisBlock() const
Serialized script, used inside transaction inputs and outputs.
void UninterruptibleSleep(const std::chrono::microseconds &n)
std::vector< CTransactionRef > vtx
bool FindTx(const uint256 &tx_hash, uint256 &block_hash, CTransactionRef &tx) const
Look up a transaction by hash.
const CChainParams & Params()
Return the currently selected parameters.
std::unique_ptr< ChainstateManager > chainman
TxIndex is used to look up transactions included in the blockchain by hash.
const uint256 & GetHash() const
bool Start(CChainState &active_chainstate)
Start initializes the sync state and registers the instance as a ValidationInterface so that it stays...
int64_t GetTimeMillis()
Returns the system time (not mockable)
#define BOOST_CHECK(expr)