This PR was split from #14906 and is a prerequisite for it.
It updates tests and benchmarks, removing all implicit calls to CTransaction(CMutableTransaction&)
constructors. This will make possible making the constructor explicit in the next PR.
The original rationale for making the constructor explicit:
- Conversion constructors should not be explicit unless there’s a strong reason for it (in the opinion of, for example, https://google.github.io/styleguide/cppguide.html, and https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ro-conversion. Let me know your take on this).
- This particular conversion is very costly – it implies a serialization plus hash of the transaction.
- Even though
CTransaction
andCMutableTransaction
represent the same data, they have very different use cases and performance properties. - Making it explicit allows for easier reasoning of performance trade-offs.
- There has been previous performance issues caused by unneeded use of this implicit conversion.
- This PR creates a map for places to look for possible refactoring and performance gains (this benefit still holds if the PR is not merged).