| 209 | } |
| 210 | |
| 211 | static void MutateTxRBFOptIn(CMutableTransaction& tx, const std::string& strInIdx) |
| 212 | { |
| 213 | // parse requested index |
| 214 | int64_t inIdx; |
| 215 | if (!ParseInt64(strInIdx, &inIdx) || inIdx < 0 || inIdx >= static_cast<int64_t>(tx.vin.size())) { |
| 216 | throw std::runtime_error("Invalid TX input index '" + strInIdx + "'"); |
| 217 | } |
| 218 | |
| 219 | // set the nSequence to MAX_INT - 2 (= RBF opt in flag) |
| 220 | int cnt = 0; |
| 221 | for (CTxIn& txin : tx.vin) { |
| 222 | if (strInIdx == "" || cnt == inIdx) { |
| 223 | if (txin.nSequence > MAX_BIP125_RBF_SEQUENCE) { |
| 224 | txin.nSequence = MAX_BIP125_RBF_SEQUENCE; |
| 225 | } |
| 226 | } |
| 227 | ++cnt; |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInput) |
| 232 | { |
no test coverage detected