MCPcopy Create free account
hub / github.com/ElementsProject/elements / create_placeholder_tx

Function create_placeholder_tx

src/test/txpackage_tests.cpp:20–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19// Create placeholder transactions that have no meaning.
20inline CTransactionRef create_placeholder_tx(size_t num_inputs, size_t num_outputs)
21{
22 CMutableTransaction mtx = CMutableTransaction();
23 mtx.vin.resize(num_inputs);
24 mtx.vout.resize(num_outputs);
25 auto random_script = CScript() << ToByteVector(InsecureRand256()) << ToByteVector(InsecureRand256());
26 for (size_t i{0}; i < num_inputs; ++i) {
27 mtx.vin[i].prevout.hash = InsecureRand256();
28 mtx.vin[i].prevout.n = 0;
29 mtx.vin[i].scriptSig = random_script;
30 }
31 for (size_t o{0}; o < num_outputs; ++o) {
32 mtx.vout[o].nValue = 1 * CENT;
33 mtx.vout[o].scriptPubKey = random_script;
34 }
35 return MakeTransactionRef(mtx);
36}
37
38BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup)
39{

Callers 1

BOOST_FIXTURE_TEST_CASEFunction · 0.85

Calls 6

ToByteVectorFunction · 0.85
InsecureRand256Function · 0.85
CMutableTransactionClass · 0.50
CScriptClass · 0.50
MakeTransactionRefFunction · 0.50
resizeMethod · 0.45

Tested by

no test coverage detected