test: refactor: Pass rng parameters to test functions

Add FastRandomContext parameter to the utility function
AddTestCoin(), and a few local test functions and classes.
This commit is contained in:
Ryan Ofsky
2024-08-14 08:46:20 -04:00
committed by MarcoFalke
parent fa19af555d
commit 68f77dd21e
12 changed files with 58 additions and 40 deletions

View File

@@ -13,10 +13,10 @@
#include <stdint.h>
#include <utility>
COutPoint AddTestCoin(CCoinsViewCache& coins_view)
COutPoint AddTestCoin(FastRandomContext& rng, CCoinsViewCache& coins_view)
{
Coin new_coin;
COutPoint outpoint{Txid::FromUint256(InsecureRand256()), /*nIn=*/0};
COutPoint outpoint{Txid::FromUint256(rng.rand256()), /*nIn=*/0};
new_coin.nHeight = 1;
new_coin.out.nValue = InsecureRandMoneyAmount();
new_coin.out.scriptPubKey.assign(uint32_t{56}, 1);