Previously the CoinbaseTx returned by the Mining IPC interface always included the witness field and SegWit OP_RETURN output. This is unnecessary for empty blocks, and for blocks without any SegWit spends.
This PR omits them for blocks with SegWit spends, but gives clients the option to keep them. RPC behavior is unchanged.
Strictly speaking it's a breaking change for <= v31 IPC clients, because they can't opt out of the new behavior. The interface is experimental so this is fine in general.
This is a breaking change for current versions of SRI, see #35393 (comment).
Two alternatives are worth considering:
- Always omit them for IPC clients, don't expose
always_add_coinbase_commitment(it's still needed internally for the RPC exception) - Keep the current behavior of always adding these fields; empty blocks don't need the space savings