Merge bitcoin/bitcoin#34568: mining: Break compatibility with existing IPC mining clients

f700609e8a doc: Release notes for mining IPC interface bump (Ryan Ofsky)
9453c15361 ipc mining: break compatibility with existing clients (version bump) (Sjors Provoost)
70de5cc2d2 ipc mining: pass missing context to BlockTemplate methods (incompatible schema change) (Sjors Provoost)
2278f017af ipc mining: remove deprecated methods (incompatible schema change) (Ryan Ofsky)
c6638fa7c5 ipc mining: provide default option values (incompatible schema change) (Ryan Ofsky)
a4603ac774 ipc mining: declare constants for default field values (Ryan Ofsky)
ff995b50cf ipc test: add workaround to block_reserved_weight exception test (Ryan Ofsky)
b970cdf20f test framework: expand expected_stderr, expected_ret_code options (Ryan Ofsky)
df53a3e5ec rpc refactor: stop using deprecated getCoinbaseCommitment method (Ryan Ofsky)

Pull request description:

  This PR increments the field number of the `Init.makeMining` method and makes the old `makeMining` method return an error, so IPC mining clients not using the latest schema file will get an error and not be able to access the Mining interface.

  Normally, there shouldn't be a need to break compatibility this way, but the mining interface has evolved a lot since it was first introduced, with old clients using the original methods less stable and performant than newer clients. So now is a good time to introduce a cutoff, drop deprecated methods, and stop supporting old clients which can't function as well.

  Bumping the field number is also an opportunity to make other improvements that would be awkward to implement compatibly:
  - Making Cap'n Proto default parameter and field values match default values of corresponding C++ methods and structs.
  - Adding missing Context parameters to Mining.createNewBlock and checkBlock methods so these methods will be executed on separate execution threads and not block the Cap'n Proto event loop thread.

  More details about these changes are in the commit messages.

ACKs for top commit:
  Sjors:
    ACK f700609e8a
  enirox001:
    ACK f700609e8a
  ismaelsadeeq:
    ACK f700609e8a
  sedited:
    ACK f700609e8a

Tree-SHA512: 0901886af00214c138643b33cec21647de5671dfff2021afe06d78dfd970664a844cde9a1e28f685bb27edccaf6e0c3f2d1e6bb4164bde6b84f42955946e366d
This commit is contained in:
merge-script
2026-02-20 11:06:06 +01:00
19 changed files with 103 additions and 122 deletions

View File

@@ -890,26 +890,11 @@ public:
return m_block_template->vTxSigOpsCost;
}
CTransactionRef getCoinbaseRawTx() override
{
return m_block_template->block.vtx[0];
}
CoinbaseTx getCoinbaseTx() override
{
return m_block_template->m_coinbase_tx;
}
std::vector<unsigned char> getCoinbaseCommitment() override
{
return m_block_template->vchCoinbaseCommitment;
}
int getWitnessCommitmentIndex() override
{
return GetWitnessCommitmentIndex(m_block_template->block);
}
std::vector<uint256> getCoinbaseMerklePath() override
{
return TransactionMerklePath(m_block_template->block, 0);

View File

@@ -197,7 +197,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock()
coinbase_tx.lock_time = coinbaseTx.nLockTime;
pblock->vtx[0] = MakeTransactionRef(std::move(coinbaseTx));
pblocktemplate->vchCoinbaseCommitment = m_chainstate.m_chainman.GenerateCoinbaseCommitment(*pblock, pindexPrev);
m_chainstate.m_chainman.GenerateCoinbaseCommitment(*pblock, pindexPrev);
const CTransactionRef& final_coinbase{pblock->vtx[0]};
if (final_coinbase->HasWitness()) {

View File

@@ -46,7 +46,6 @@ struct CBlockTemplate
std::vector<CAmount> vTxFees;
// Sigops per transaction, not including coinbase transaction (unlike CBlock::vtx).
std::vector<int64_t> vTxSigOpsCost;
std::vector<unsigned char> vchCoinbaseCommitment;
/* A vector of package fee rates, ordered by the sequence in which
* packages are selected for inclusion in the block template.*/
std::vector<FeePerVSize> m_package_feerates;

View File

@@ -55,7 +55,7 @@ struct BlockCreateOptions {
* The maximum additional sigops which the pool will add in coinbase
* transaction outputs.
*/
size_t coinbase_output_max_additional_sigops{400};
size_t coinbase_output_max_additional_sigops{DEFAULT_COINBASE_OUTPUT_MAX_ADDITIONAL_SIGOPS};
/**
* Script to put in the coinbase transaction. The default is an
* anyone-can-spend dummy.