if (isfromzaddr_ && !find_unspent_notes()) {
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds, no unspent notes found for zaddr from address.");
}
-
+
+ // Check mempooltxinputlimit to avoid creating a transaction which the local mempool rejects
+ if (isfromtaddr_) {
+ size_t limit = (size_t)GetArg("-mempooltxinputlimit", 0);
+ if (limit > 0) {
+ size_t n = t_inputs_.size();
+ if (n > limit) {
+ throw JSONRPCError(RPC_WALLET_ERROR, strprintf("Too many transparent inputs %zu > limit %zu", n, limit));
+ }
+ }
+ }
+
CAmount t_inputs_total = 0;
for (SendManyInputUTXO & t : t_inputs_) {
t_inputs_total += std::get<2>(t);
txNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second,CScript(),
std::numeric_limits<unsigned int>::max()-1));
+ // Check mempooltxinputlimit to avoid creating a transaction which the local mempool rejects
+ size_t limit = (size_t)GetArg("-mempooltxinputlimit", 0);
+ if (limit > 0) {
+ size_t n = txNew.vin.size();
+ if (n > limit) {
+ strFailReason = _(strprintf("Too many transparent inputs %zu > limit %zu", n, limit).c_str());
+ return false;
+ }
+ }
+
// Sign
int nIn = 0;
CTransaction txNewConst(txNew);