mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-04 10:07:27 -05:00
fa32adf9dc
-BEGIN VERIFY SCRIPT- # General rename helper: $1 -> $2 rename_global() { sed -i "s/\<$1\>/$2/g" $(git grep -l "$1"); } # Helper to rename TxoutType $1 rename_value() { sed -i "s/ TX_$1,/ $1,/g" src/script/standard.h; # First strip the prefix in the definition (header) rename_global TX_$1 "TxoutType::$1"; # Then replace globally } # Change the type globally to bring it in line with the style-guide # (clsses are UpperCamelCase) rename_global 'enum txnouttype' 'enum class TxoutType' rename_global 'txnouttype' 'TxoutType' # Now rename each enum value rename_value 'NONSTANDARD' rename_value 'PUBKEY' rename_value 'PUBKEYHASH' rename_value 'SCRIPTHASH' rename_value 'MULTISIG' rename_value 'NULL_DATA' rename_value 'WITNESS_V0_KEYHASH' rename_value 'WITNESS_V0_SCRIPTHASH' rename_value 'WITNESS_UNKNOWN' -END VERIFY SCRIPT-
29 lines
1.3 KiB
C++
29 lines
1.3 KiB
C++
// Copyright (c) 2019-2020 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H
|
|
#define BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H
|
|
|
|
#include <primitives/transaction.h>
|
|
|
|
#include <array>
|
|
|
|
class FillableSigningProvider;
|
|
class CCoinsViewCache;
|
|
|
|
// 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);
|
|
|
|
// Helper: create two dummy transactions, each with two outputs.
|
|
// 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.
|
|
std::vector<CMutableTransaction> SetupDummyInputs(FillableSigningProvider& keystoreRet, CCoinsViewCache& coinsRet, const std::array<CAmount,4>& nValues);
|
|
|
|
#endif // BITCOIN_TEST_UTIL_TRANSACTION_UTILS_H
|