| 193 | } |
| 194 | |
| 195 | static UniValue generateBlocks(ChainstateManager& chainman, Mining& miner, const CScript& coinbase_output_script, int nGenerate, uint64_t nMaxTries) |
| 196 | { |
| 197 | UniValue blockHashes(UniValue::VARR); |
| 198 | while (nGenerate > 0 && !chainman.m_interrupt) { |
| 199 | std::unique_ptr<BlockTemplate> block_template(miner.createNewBlock({ .coinbase_output_script = coinbase_output_script }, /*cooldown=*/false)); |
| 200 | CHECK_NONFATAL(block_template); |
| 201 | |
| 202 | std::shared_ptr<const CBlock> block_out; |
| 203 | if (!GenerateBlock(chainman, block_template->getBlock(), nMaxTries, block_out, /*process_new_block=*/true)) { |
| 204 | break; |
| 205 | } |
| 206 | |
| 207 | if (block_out) { |
| 208 | --nGenerate; |
| 209 | blockHashes.push_back(block_out->GetHash().GetHex()); |
| 210 | } |
| 211 | } |
| 212 | return blockHashes; |
| 213 | } |
| 214 | |
| 215 | static bool getScriptFromDescriptor(std::string_view descriptor, CScript& script, std::string& error) |
| 216 | { |
no test coverage detected