Attempted cleaning that up, but didn't uncover anything useful to the end users, unlike #30444, so probably not worth following up on:
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index 89c03c1647..dab8b81128 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -274,8 +274,8 @@ static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInpu
// extract and validate vout
const std::string& strVout = vStrInputParts[1];
- int64_t vout;
- if (!ParseInt64(strVout, &vout) || vout < 0 || vout > static_cast<int64_t>(maxVout))
+ const auto vout{ToIntegral<uint32_t>(strVout)};
+ if (!vout || *vout > maxVout)
throw std::runtime_error("invalid TX input vout '" + strVout + "'");
// extract the optional sequence number
@@ -285,7 +285,7 @@ static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInpu
}
// append to transaction input list
- CTxIn txin(*txid, vout, CScript(), nSequenceIn);
+ CTxIn txin{*txid, *vout, CScript(), nSequenceIn};
tx.vin.push_back(txin);
}
@@ -634,7 +634,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
if (nOut < 0)
throw std::runtime_error("vout cannot be negative");
- COutPoint out(*txid, nOut);
+ COutPoint out{*txid, static_cast<uint32_t>(nOut)};
std::vector<unsigned char> pkData(ParseHexUV(prevOut["scriptPubKey"], "scriptPubKey"));
CScript scriptPubKey(pkData.begin(), pkData.end());