Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/transaction_utils.h
// Copyright (c) 2019 The Bitcoin Core developers | // Copyright (c) 2019 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H | #ifndef BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H | ||||
#define BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H | #define BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H | ||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <array> | |||||
class FillableSigningProvider; | |||||
class CCoinsViewCache; | |||||
// create crediting transaction | // create crediting transaction | ||||
// [1 coinbase input => 1 output with given scriptPubkey and value] | // [1 coinbase input => 1 output with given scriptPubkey and value] | ||||
CMutableTransaction BuildCreditingTransaction(const CScript &scriptPubKey, | CMutableTransaction BuildCreditingTransaction(const CScript &scriptPubKey, | ||||
const Amount nValue); | const Amount nValue); | ||||
// create spending transaction | // create spending transaction | ||||
// [1 input with referenced transaction outpoint, scriptSig => | // [1 input with referenced transaction outpoint, scriptSig => | ||||
// 1 output with empty scriptPubKey, full value of referenced transaction] | // 1 output with empty scriptPubKey, full value of referenced transaction] | ||||
CMutableTransaction BuildSpendingTransaction(const CScript &scriptSig, | CMutableTransaction BuildSpendingTransaction(const CScript &scriptSig, | ||||
const CTransaction &txCredit); | const CTransaction &txCredit); | ||||
// Helper: create two dummy transactions, each with two outputs. | |||||
// The first has nValues[0] and nValues[1] outputs paid to a TX_PUBKEY, | |||||
// the second nValues[2] and nValues[3] outputs paid to a TX_PUBKEYHASH. | |||||
std::vector<CMutableTransaction> | |||||
SetupDummyInputs(FillableSigningProvider &keystoreRet, | |||||
CCoinsViewCache &coinsRet, | |||||
const std::array<Amount, 4> &nValues); | |||||
#endif // BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H | #endif // BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H |