Very simple block filter index sync benchmark, only using coinbase outputs.
| 29 | |
| 30 | // Very simple block filter index sync benchmark, only using coinbase outputs. |
| 31 | static void BlockFilterIndexSync(benchmark::Bench& bench) |
| 32 | { |
| 33 | const auto test_setup = MakeNoLogFileContext<TestChain100Setup>(); |
| 34 | |
| 35 | // Create more blocks |
| 36 | int CHAIN_SIZE = 600; |
| 37 | CPubKey pubkey{"02ed26169896db86ced4cbb7b3ecef9859b5952825adbeab998fb5b307e54949c9"_hex_u8}; |
| 38 | CScript script = GetScriptForDestination(WitnessV0KeyHash(pubkey)); |
| 39 | std::vector<CMutableTransaction> noTxns; |
| 40 | for (int i = 0; i < CHAIN_SIZE - 100; i++) { |
| 41 | test_setup->CreateAndProcessBlock(noTxns, script); |
| 42 | test_setup->m_clock += 1s; |
| 43 | } |
| 44 | assert(WITH_LOCK(::cs_main, return test_setup->m_node.chainman->ActiveHeight() == CHAIN_SIZE)); |
| 45 | |
| 46 | bench.minEpochIterations(5).run([&] { |
| 47 | BlockFilterIndex filter_index(interfaces::MakeChain(test_setup->m_node), BlockFilterType::BASIC, |
| 48 | /*n_cache_size=*/0, /*f_memory=*/false, /*f_wipe=*/true); |
| 49 | assert(filter_index.Init()); |
| 50 | assert(!filter_index.BlockUntilSyncedToCurrentChain()); |
| 51 | filter_index.Sync(); |
| 52 | |
| 53 | IndexSummary summary = filter_index.GetSummary(); |
| 54 | assert(summary.synced); |
| 55 | assert(summary.best_block_hash == WITH_LOCK(::cs_main, return test_setup->m_node.chainman->ActiveTip()->GetBlockHash())); |
| 56 | |
| 57 | // Shutdown sequence (c.f. Shutdown() in init.cpp) |
| 58 | filter_index.Stop(); |
| 59 | }); |
| 60 | } |
| 61 | |
| 62 | BENCHMARK(BlockFilterIndexSync); |
nothing calls this directly
no test coverage detected