mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-15 22:32:37 -03:00
a0fc076476
prototypes used in src/test/script_tests.cpp: - CMutableTransaction BuildCreditingTransaction(const CScript& scriptPubKey, int nValue = 0); - CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CScriptWitness& scriptWitness, const CTransaction& txCredit); prototypes used in bench/verify_script.cpp: - CMutableTransaction BuildCreditingTransaction(const CScript& scriptPubKey); - CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CMutableTransaction& txCredit); The more generic versions from the script tests are moved into a new file pair transaction_utils.cpp/h and the calls are adapted accordingly in the verify_script benchmark (passing the nValue of 1 explicitely for BuildCreditingTransaction(), passing empty scriptWitness explicitely and converting txCredit parameter to CTransaction in BuildSpendingTransaction()).
19 lines
883 B
C
19 lines
883 B
C
// Copyright (c) 2019 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_LIB_TRANSACTION_UTILS_H
|
|
#define BITCOIN_TEST_LIB_TRANSACTION_UTILS_H
|
|
|
|
#include <primitives/transaction.h>
|
|
|
|
// 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);
|
|
|
|
#endif // BITCOIN_TEST_LIB_TRANSACTION_UTILS_H
|