MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / MutateTxAddOutData

Function MutateTxAddOutData

src/bitcoin-tx.cpp:408–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

406}
407
408static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strInput)
409{
410 CAmount value = 0;
411
412 // separate [VALUE:]DATA in string
413 size_t pos = strInput.find(':');
414
415 if (pos==0)
416 throw std::runtime_error("TX output value not specified");
417
418 if (pos != std::string::npos) {
419 // Extract and validate VALUE
420 value = ExtractAndValidateValue(strInput.substr(0, pos));
421 }
422
423 // extract and validate DATA
424 std::string strData = strInput.substr(pos + 1, std::string::npos);
425
426 if (!IsHex(strData))
427 throw std::runtime_error("invalid TX output data");
428
429 std::vector<unsigned char> data = ParseHex(strData);
430
431 CTxOut txout(value, CScript() << OP_RETURN << data);
432 tx.vout.push_back(txout);
433}
434
435static void MutateTxAddOutScript(CMutableTransaction& tx, const std::string& strInput)
436{

Callers 1

MutateTxFunction · 0.85

Calls 6

ExtractAndValidateValueFunction · 0.85
IsHexFunction · 0.85
ParseHexFunction · 0.85
CScriptClass · 0.70
findMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected