This PR creates a common interface for CMutableTransaction
and CTransaction
as the template class CBaseTransaction<T>
. This base class uses the CRTP (curiously recurring template pattern) in order to achieve static polymorphism. This way this change shouldn’t have any effect on behaviour or runtime performance (though compilation performance is of course worse).
Rationale:
- Creates a common, explicit interface type for
CTransaction
andCMutableTransaction
. - Makes explicit common elements between two classes.
- Functions that accept have a better option than accepting an unrestricted typename T.
- Better than proliferating custom
static_assert
orenable_if
with different, obscure error messages when the template is applied to the wrong types.
PS: This PR shouldn’t affect performance or behaviour, but please review thoroughly as it touches consensus-sensitive code.