| 231 | } |
| 232 | |
| 233 | static 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 | |
| 256 | static void MutateTxDelInput(CMutableTransaction& tx, const string& strInIdx) |
| 257 | { |
no test coverage detected