```
The existing block generation rpcs for regtest, generatetoaddress and
generatetodescriptor, mine everything in the mempool up to the block
weight limit. This makes it difficult to test a system for several
scenarios where a different set of transactions are mined. For example:
Testing the common scenario where a transaction is replaced in the
mempool but the replaced transaction is mined instead.
Testing for a double-spent transaction where a transaction that
conflicts with the mempool is mined.
Testing for non-standard transactions that are mined.
Testing the scenario where several blocks are mined without a
specific transaction in the mempool being included in a block.
This PR introduces a new rpc, generateblock, that takes an array of raw
transactions and txids and mines only those and the coinbase. Any txids
must be in the mempool, but the raw txs can be anything conforming to
consensus rules. The coinbase can be specified as either an address or
descriptor.
```
Backport of core PR17693.
The code has been adapted to remove the Segwit parts. For now the RPC
interface is kept identical to core, but it would be interesting to not
enforce CTOR in the call and sort the txs in the RPC code instead to
make it easier to mix raw txs and txids.