Add option 'mempooltxinputlimit' so the mempool can reject a transaction
based on the number of transparent inputs.
This commit is contained in:
12
src/init.cpp
12
src/init.cpp
@@ -332,6 +332,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-dbcache=<n>", strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache));
|
||||
strUsage += HelpMessageOpt("-loadblock=<file>", _("Imports blocks from external blk000??.dat file") + " " + _("on startup"));
|
||||
strUsage += HelpMessageOpt("-maxorphantx=<n>", strprintf(_("Keep at most <n> unconnectable transactions in memory (default: %u)"), DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
||||
strUsage += HelpMessageOpt("-mempooltxinputlimit=<n>", _("Set the maximum number of transparent inputs in a transaction that the mempool will accept (default: 0 = no limit applied)"));
|
||||
strUsage += HelpMessageOpt("-par=<n>", strprintf(_("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"),
|
||||
-(int)boost::thread::hardware_concurrency(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS));
|
||||
#ifndef WIN32
|
||||
@@ -1009,6 +1010,17 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Default value of 0 for mempooltxinputlimit means no limit is applied
|
||||
if (mapArgs.count("-mempooltxinputlimit")) {
|
||||
int64_t limit = GetArg("-mempooltxinputlimit", 0);
|
||||
if (limit < 0) {
|
||||
return InitError(_("Mempool limit on transparent inputs to a transaction cannot be negative"));
|
||||
} else if (limit > 0) {
|
||||
LogPrintf("Mempool configured to reject transactions with greater than %lld transparent inputs\n", limit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
|
||||
|
||||
// Initialize libsodium
|
||||
|
||||
Reference in New Issue
Block a user