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

Function MutateTxAddOutAddr

src/bitcoin-tx.cpp:265–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265static void MutateTxAddOutAddr(CMutableTransaction& tx, const std::string& strInput)
266{
267 // Separate into VALUE:ADDRESS
268 std::vector<std::string> vStrInputParts;
269 boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
270
271 if (vStrInputParts.size() != 2)
272 throw std::runtime_error("TX output missing or too many separators");
273
274 // Extract and validate VALUE
275 CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
276
277 // extract and validate ADDRESS
278 std::string strAddr = vStrInputParts[1];
279 CTxDestination destination = DecodeDestination(strAddr);
280 if (!IsValidDestination(destination)) {
281 throw std::runtime_error("invalid TX output address");
282 }
283 CScript scriptPubKey = GetScriptForDestination(destination);
284
285 // construct TxOut, append to transaction output list
286 CTxOut txout(value, scriptPubKey);
287 tx.vout.push_back(txout);
288}
289
290static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& strInput)
291{

Callers 1

MutateTxFunction · 0.85

Calls 6

ExtractAndValidateValueFunction · 0.85
DecodeDestinationFunction · 0.85
IsValidDestinationFunction · 0.85
GetScriptForDestinationFunction · 0.85
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected