| 2515 | }; |
| 2516 | |
| 2517 | static bool CheckBlockFilterMatches(BlockManager& blockman, const CBlockIndex& blockindex, const GCSFilter::ElementSet& needles) |
| 2518 | { |
| 2519 | const CBlock block{GetBlockChecked(blockman, blockindex)}; |
| 2520 | const CBlockUndo block_undo{GetUndoChecked(blockman, blockindex)}; |
| 2521 | |
| 2522 | // Check if any of the outputs match the scriptPubKey |
| 2523 | for (const auto& tx : block.vtx) { |
| 2524 | if (std::any_of(tx->vout.cbegin(), tx->vout.cend(), [&](const auto& txout) { |
| 2525 | return needles.contains(std::vector<unsigned char>(txout.scriptPubKey.begin(), txout.scriptPubKey.end())); |
| 2526 | })) { |
| 2527 | return true; |
| 2528 | } |
| 2529 | } |
| 2530 | // Check if any of the inputs match the scriptPubKey |
| 2531 | for (const auto& txundo : block_undo.vtxundo) { |
| 2532 | if (std::any_of(txundo.vprevout.cbegin(), txundo.vprevout.cend(), [&](const auto& coin) { |
| 2533 | return needles.contains(std::vector<unsigned char>(coin.out.scriptPubKey.begin(), coin.out.scriptPubKey.end())); |
| 2534 | })) { |
| 2535 | return true; |
| 2536 | } |
| 2537 | } |
| 2538 | |
| 2539 | return false; |
| 2540 | } |
| 2541 | |
| 2542 | static RPCMethod scanblocks() |
| 2543 | { |
no test coverage detected