| 263 | } |
| 264 | |
| 265 | static 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 | |
| 290 | static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& strInput) |
| 291 | { |
no test coverage detected