blob: 7e10c7c58d360ec5bf99550937ff7f6ccada851f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// 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>
COutPoint AddTestCoin(FastRandomContext& rng, CCoinsViewCache& coins_view)
{
Coin new_coin;
COutPoint outpoint{Txid::FromUint256(rng.rand256()), /*nIn=*/0};
new_coin.nHeight = 1;
new_coin.out.nValue = RandMoney(rng);
new_coin.out.scriptPubKey.assign(uint32_t{56}, 1);
coins_view.AddCoin(outpoint, std::move(new_coin), /*possible_overwrite=*/false);
return outpoint;
};
|