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

Function TestSimpleSpend

src/wallet/test/wallet_tests.cpp:72–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72static CMutableTransaction TestSimpleSpend(const CTransaction& from, uint32_t index, const CKey& key, const CScript& pubkey)
73{
74 CMutableTransaction mtx;
75 CTxOut txOutNew = CTxOut();
76 txOutNew.nValue = from.vout[index].nValue.GetAmount() - DEFAULT_TRANSACTION_MAXFEE;
77 txOutNew.nAsset = from.vout[index].nAsset;
78 txOutNew.scriptPubKey = pubkey;
79 mtx.vout.push_back(txOutNew);
80 mtx.vin.push_back({CTxIn{from.GetHash(), index}});
81 FillableSigningProvider keystore;
82 keystore.AddKey(key);
83 std::map<COutPoint, Coin> coins;
84 coins[mtx.vin[0].prevout].out = from.vout[index];
85 std::map<int, bilingual_str> input_errors;
86 BOOST_CHECK(SignTransaction(mtx, &keystore, coins, SIGHASH_ALL, Params().HashGenesisBlock(), input_errors));
87 return mtx;
88}
89
90static void AddKey(CWallet& wallet, const CKey& key)
91{

Callers 1

BOOST_FIXTURE_TEST_CASEFunction · 0.85

Calls 7

GetAmountMethod · 0.80
CTxOutClass · 0.50
SignTransactionFunction · 0.50
ParamsClass · 0.50
push_backMethod · 0.45
GetHashMethod · 0.45
AddKeyMethod · 0.45

Tested by

no test coverage detected