2023-02-01 08:53:21 -08:00
|
|
|
// Copyright (c) 2023 The Bitcoin Core developers
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#include <test/util/coins.h>
|
|
|
|
|
|
|
|
#include <coins.h>
|
|
|
|
#include <primitives/transaction.h>
|
|
|
|
#include <script/script.h>
|
|
|
|
#include <test/util/random.h>
|
|
|
|
#include <uint256.h>
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <utility>
|
|
|
|
|
2024-08-14 08:46:20 -04:00
|
|
|
COutPoint AddTestCoin(FastRandomContext& rng, CCoinsViewCache& coins_view)
|
2023-02-01 08:53:21 -08:00
|
|
|
{
|
|
|
|
Coin new_coin;
|
2024-08-14 08:46:20 -04:00
|
|
|
COutPoint outpoint{Txid::FromUint256(rng.rand256()), /*nIn=*/0};
|
2023-02-01 08:53:21 -08:00
|
|
|
new_coin.nHeight = 1;
|
2024-08-02 12:30:13 +02:00
|
|
|
new_coin.out.nValue = RandMoney(rng);
|
2023-02-01 08:53:21 -08:00
|
|
|
new_coin.out.scriptPubKey.assign(uint32_t{56}, 1);
|
|
|
|
coins_view.AddCoin(outpoint, std::move(new_coin), /*possible_overwrite=*/false);
|
|
|
|
|
|
|
|
return outpoint;
|
|
|
|
};
|