It seems safe to optimize this boolean expression and remove the IsCoinBase()
condition in IsImmatureCoinBase
, because GetBlocksToMaturity
already calls IsCoinBase
, which effectively makes this condition redundant.
I do however appreciate the defensiveness of having the redundantIsCoinBase()
condition; it is not specified that GetBlocksToMaturity
must return 0
if it is not a coinbase transaction.
Therefore, if we optimize the boolean expression in IsImmatureCoinBase
and fully rely on the result of GetBlocksToMaturity
, I would like to suggest to add a comment to the interface documentation of the CMerkleTx::GetBlocksToMaturity
method that explicitly states the postcondition that GetBlocksToMaturity
must return 0
if it is not a coinbase transaction.