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

Function MutateTxAddOutAddr

src/bitcoin-tx.cpp:295–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295static void MutateTxAddOutAddr(CMutableTransaction& tx, const std::string& strInput)
296{
297 // Separate into VALUE:ADDRESS
298 std::vector<std::string> vStrInputParts = SplitString(strInput, ':');
299
300 if (vStrInputParts.size() != 2)
301 throw std::runtime_error("TX output missing or too many separators");
302
303 // Extract and validate VALUE
304 CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
305
306 // extract and validate ADDRESS
307 const std::string& strAddr = vStrInputParts[1];
308 CTxDestination destination = DecodeDestination(strAddr);
309 if (!IsValidDestination(destination)) {
310 throw std::runtime_error("invalid TX output address");
311 }
312 CScript scriptPubKey = GetScriptForDestination(destination);
313
314 // construct TxOut, append to transaction output list
315 CTxOut txout(value, scriptPubKey);
316 tx.vout.push_back(txout);
317}
318
319static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& strInput)
320{

Callers 1

MutateTxFunction · 0.85

Calls 7

SplitStringFunction · 0.85
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