| 212 | |
| 213 | template <typename T> |
| 214 | [[nodiscard]] bool MultiplicationOverflow(const T i, const T j) noexcept |
| 215 | { |
| 216 | static_assert(std::is_integral<T>::value, "Integral required."); |
| 217 | if (std::numeric_limits<T>::is_signed) { |
| 218 | if (i > 0) { |
| 219 | if (j > 0) { |
| 220 | return i > (std::numeric_limits<T>::max() / j); |
| 221 | } else { |
| 222 | return j < (std::numeric_limits<T>::min() / i); |
| 223 | } |
| 224 | } else { |
| 225 | if (j > 0) { |
| 226 | return i < (std::numeric_limits<T>::min() / j); |
| 227 | } else { |
| 228 | return i != 0 && (j < (std::numeric_limits<T>::max() / i)); |
| 229 | } |
| 230 | } |
| 231 | } else { |
| 232 | return j != 0 && i > std::numeric_limits<T>::max() / j; |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | [[nodiscard]] bool ContainsSpentInput(const CTransaction& tx, const CCoinsViewCache& inputs) noexcept; |
| 237 |
no outgoing calls
no test coverage detected