MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / make_tx

Function make_tx

src/test/rbf_tests.cpp:19–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17BOOST_FIXTURE_TEST_SUITE(rbf_tests, BasicTestingSetup)
18
19static inline CTransactionRef make_tx(const std::vector<CTransactionRef>& inputs,
20 const std::vector<CAmount>& output_values)
21{
22 CMutableTransaction tx = CMutableTransaction();
23 tx.vin.resize(inputs.size());
24 tx.vout.resize(output_values.size());
25 for (size_t i = 0; i < inputs.size(); ++i) {
26 tx.vin[i].prevout.hash = inputs[i]->GetHash();
27 tx.vin[i].prevout.n = 0;
28 // Add a witness so wtxid != txid
29 CScriptWitness witness;
30 witness.stack.emplace_back(i + 10);
31 tx.vin[i].scriptWitness = witness;
32 }
33 for (size_t i = 0; i < output_values.size(); ++i) {
34 tx.vout[i].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
35 tx.vout[i].nValue = output_values[i];
36 }
37 return MakeTransactionRef(tx);
38}
39
40static CTransactionRef add_descendants(const CTransactionRef& tx, int32_t num_descendants, CTxMemPool& pool)
41 EXCLUSIVE_LOCKS_REQUIRED(::cs_main, pool.cs)

Callers 2

rbf_tests.cppFile · 0.70
BOOST_FIXTURE_TEST_CASEFunction · 0.70

Calls 7

MakeTransactionRefFunction · 0.85
CMutableTransactionClass · 0.50
CScriptClass · 0.50
resizeMethod · 0.45
sizeMethod · 0.45
GetHashMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected