Bitcoin Core  22.99.0
P2P Digital Currency
transaction_utils.h
Go to the documentation of this file.
1 // Copyright (c) 2019-2020 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H
6 #define BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H
7 
9 
10 #include <array>
11 
13 class CCoinsViewCache;
14 
15 // create crediting transaction
16 // [1 coinbase input => 1 output with given scriptPubkey and value]
17 CMutableTransaction BuildCreditingTransaction(const CScript& scriptPubKey, int nValue = 0);
18 
19 // create spending transaction
20 // [1 input with referenced transaction outpoint, scriptSig, scriptWitness =>
21 // 1 output with empty scriptPubKey, full value of referenced transaction]
22 CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CScriptWitness& scriptWitness, const CTransaction& txCredit);
23 
24 // Helper: create two dummy transactions, each with two outputs.
25 // The first has nValues[0] and nValues[1] outputs paid to a TxoutType::PUBKEY,
26 // the second nValues[2] and nValues[3] outputs paid to a TxoutType::PUBKEYHASH.
27 std::vector<CMutableTransaction> SetupDummyInputs(FillableSigningProvider& keystoreRet, CCoinsViewCache& coinsRet, const std::array<CAmount,4>& nValues);
28 
29 #endif // BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H
transaction.h
FillableSigningProvider
Fillable signing provider that keeps keys in an address->secret map.
Definition: signingprovider.h:91
CTransaction
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:259
CScriptWitness
Definition: script.h:557
SetupDummyInputs
std::vector< CMutableTransaction > SetupDummyInputs(FillableSigningProvider &keystoreRet, CCoinsViewCache &coinsRet, const std::array< CAmount, 4 > &nValues)
Definition: transaction_utils.cpp:43
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:405
CCoinsViewCache
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition: coins.h:213
BuildSpendingTransaction
CMutableTransaction BuildSpendingTransaction(const CScript &scriptSig, const CScriptWitness &scriptWitness, const CTransaction &txCredit)
Definition: transaction_utils.cpp:25
CMutableTransaction
A mutable version of CTransaction.
Definition: transaction.h:344
BuildCreditingTransaction
CMutableTransaction BuildCreditingTransaction(const CScript &scriptPubKey, int nValue=0)
Definition: transaction_utils.cpp:9