From 9d92c3d7f42c18939a9a6aa1ee185f1c958360a0 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Fri, 20 Jan 2023 11:05:09 -0800 Subject: Create InsecureRandMoneyAmount() test util helper to generate semi-random CAmounts up to MAX_MONEY rather than only uint32, and use it in the unit tests. --- src/test/util/random.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/test/util/random.h') diff --git a/src/test/util/random.h b/src/test/util/random.h index 72c9ec85e2..7997e8a346 100644 --- a/src/test/util/random.h +++ b/src/test/util/random.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_TEST_UTIL_RANDOM_H #define BITCOIN_TEST_UTIL_RANDOM_H +#include #include #include #include @@ -36,4 +37,9 @@ static inline bool InsecureRandBool() return g_insecure_rand_ctx.randbool(); } +static inline CAmount InsecureRandMoneyAmount() +{ + return static_cast(InsecureRandRange(MAX_MONEY + 1)); +} + #endif // BITCOIN_TEST_UTIL_RANDOM_H -- cgit v1.2.3