GenerateCoinbaseCommitment
is public and can be used in unit tests to update the witness commitment after the list of txs in a block has been changed. However, for it to work, the existing commitment (added by default in CreateNewBlock
) must be removed (and thus its index must be known).
Make that possible by exposing the GetWitnessCommitmentIndex
helper function in the header.