2020-04-16 13:14:08 -04:00
|
|
|
// Copyright (c) 2019-2020 The Bitcoin Core developers
|
2019-10-18 02:05:05 +02:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2019-11-05 15:18:59 -05:00
|
|
|
#ifndef BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H
|
|
|
|
#define BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H
|
2019-10-18 02:05:05 +02:00
|
|
|
|
|
|
|
#include <primitives/transaction.h>
|
|
|
|
|
2020-02-18 17:11:16 +01:00
|
|
|
#include <array>
|
|
|
|
|
|
|
|
class FillableSigningProvider;
|
|
|
|
class CCoinsViewCache;
|
|
|
|
|
2019-10-18 02:05:05 +02:00
|
|
|
// create crediting transaction
|
|
|
|
// [1 coinbase input => 1 output with given scriptPubkey and value]
|
|
|
|
CMutableTransaction BuildCreditingTransaction(const CScript& scriptPubKey, int nValue = 0);
|
|
|
|
|
|
|
|
// create spending transaction
|
|
|
|
// [1 input with referenced transaction outpoint, scriptSig, scriptWitness =>
|
|
|
|
// 1 output with empty scriptPubKey, full value of referenced transaction]
|
|
|
|
CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CScriptWitness& scriptWitness, const CTransaction& txCredit);
|
|
|
|
|
2020-02-18 17:11:16 +01:00
|
|
|
// Helper: create two dummy transactions, each with two outputs.
|
2020-05-30 09:16:05 -04:00
|
|
|
// The first has nValues[0] and nValues[1] outputs paid to a TxoutType::PUBKEY,
|
|
|
|
// the second nValues[2] and nValues[3] outputs paid to a TxoutType::PUBKEYHASH.
|
2020-02-18 17:11:16 +01:00
|
|
|
std::vector<CMutableTransaction> SetupDummyInputs(FillableSigningProvider& keystoreRet, CCoinsViewCache& coinsRet, const std::array<CAmount,4>& nValues);
|
|
|
|
|
2019-11-05 15:18:59 -05:00
|
|
|
#endif // BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H
|