MCPcopy Create free account
hub / github.com/LUX-Core/lux / MutateTxAddOutScript

Function MutateTxAddOutScript

src/lux-tx.cpp:240–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240static void MutateTxAddOutScript(CMutableTransaction& tx, const string& strInput)
241{
242 // separate VALUE:SCRIPT in string
243 size_t pos = strInput.find(':');
244 if ((pos == string::npos) ||
245 (pos == 0))
246 throw runtime_error("TX output missing separator");
247
248 // extract and validate VALUE
249 string strValue = strInput.substr(0, pos);
250 CAmount value;
251 if (!ParseMoney(strValue, value))
252 throw runtime_error("invalid TX output value");
253
254 // extract and validate script
255 string strScript = strInput.substr(pos + 1, string::npos);
256 CScript scriptPubKey = ParseScript(strScript); // throws on err
257
258 // construct TxOut, append to transaction output list
259 CTxOut txout(value, scriptPubKey);
260 tx.vout.push_back(txout);
261}
262
263static void MutateTxDelInput(CMutableTransaction& tx, const string& strInIdx)
264{

Callers 1

MutateTxFunction · 0.85

Calls 4

ParseMoneyFunction · 0.85
ParseScriptFunction · 0.85
findMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected