This PR adds missing coverage for the “coinbasevalue” result field of the getblocktemplate RPC call. Specifically, the introduced test checks that the value is set to claim the full block reward (subsidy plus fees). Can be verified with the following patch, which succeeds on master and fails on the PR branch:
0diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
1index a935810d91..ba9ac9dadb 100644
2--- a/src/rpc/mining.cpp
3+++ b/src/rpc/mining.cpp
4@@ -998,7 +998,7 @@ static RPCHelpMan getblocktemplate()
5 result.pushKV("previousblockhash", block.hashPrevBlock.GetHex());
6 result.pushKV("transactions", std::move(transactions));
7 result.pushKV("coinbaseaux", std::move(aux));
8- result.pushKV("coinbasevalue", block.vtx[0]->vout[0].nValue);
9+ result.pushKV("coinbasevalue", block.vtx[0]->vout[0].nValue - 1);
10 result.pushKV("longpollid", tip.GetHex() + ToString(nTransactionsUpdatedLast));
11 result.pushKV("target", hashTarget.GetHex());
12 result.pushKV("mintime", GetMinimumTime(pindexPrev, consensusParams.DifficultyAdjustmentInterval()));
I’m not sure how relevant this field is nowadays in real-world mining scenarios (we use it for the signet miner at least), but it seems useful to have a test for it anyways. Stumbled upon this while looking at https://github.com/bitcoin-inquisition/bitcoin/pull/111.