MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / MutateTxAddOutScript

Function MutateTxAddOutScript

src/bitcoin-tx.cpp:233–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

MutateTxFunction · 0.85

Calls 4

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

Tested by

no test coverage detected