MCPcopy Create free account
hub / github.com/ElementsProject/elements / MutateTxRBFOptIn

Function MutateTxRBFOptIn

src/bitcoin-tx.cpp:225–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225static void MutateTxRBFOptIn(CMutableTransaction& tx, const std::string& strInIdx)
226{
227 // parse requested index
228 int64_t inIdx;
229 if (!ParseInt64(strInIdx, &inIdx) || inIdx < 0 || inIdx >= static_cast<int64_t>(tx.vin.size())) {
230 throw std::runtime_error("Invalid TX input index '" + strInIdx + "'");
231 }
232
233 // set the nSequence to MAX_INT - 2 (= RBF opt in flag)
234 int cnt = 0;
235 for (CTxIn& txin : tx.vin) {
236 if (strInIdx == "" || cnt == inIdx) {
237 if (txin.nSequence > MAX_BIP125_RBF_SEQUENCE) {
238 txin.nSequence = MAX_BIP125_RBF_SEQUENCE;
239 }
240 }
241 ++cnt;
242 }
243}
244
245template <typename T>
246static T TrimAndParse(const std::string& int_str, const std::string& err)

Callers 1

MutateTxFunction · 0.85

Calls 2

ParseInt64Function · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected