| 238 | } |
| 239 | |
| 240 | static void MutateTxAddOutScript(CMutableTransaction& tx, const string& strInput) |
| 241 | { |
| 242 | // separate VALUE:SCRIPT in string |
| 243 | size_t pos = strInput.find(':'); |
| 244 | if ((pos == string::npos) || |
| 245 | (pos == 0)) |
| 246 | throw runtime_error("TX output missing separator"); |
| 247 | |
| 248 | // extract and validate VALUE |
| 249 | string strValue = strInput.substr(0, pos); |
| 250 | CAmount value; |
| 251 | if (!ParseMoney(strValue, value)) |
| 252 | throw runtime_error("invalid TX output value"); |
| 253 | |
| 254 | // extract and validate script |
| 255 | string strScript = strInput.substr(pos + 1, string::npos); |
| 256 | CScript scriptPubKey = ParseScript(strScript); // throws on err |
| 257 | |
| 258 | // construct TxOut, append to transaction output list |
| 259 | CTxOut txout(value, scriptPubKey); |
| 260 | tx.vout.push_back(txout); |
| 261 | } |
| 262 | |
| 263 | static void MutateTxDelInput(CMutableTransaction& tx, const string& strInIdx) |
| 264 | { |
no test coverage detected