mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-02-24 22:29:03 +00:00
Merge pull request #718 from michilumin/1.8.1-dev-limit-orphan-tx
1.8.1 dev limit orphan tx
This commit is contained in:
commit
76ebacb657
@ -210,6 +210,8 @@ std::string HelpMessage(HelpMessageMode hmm)
|
||||
strUsage += " -datadir=<dir> " + _("Specify data directory") + "\n";
|
||||
strUsage += " -dbcache=<n> " + strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache) + "\n";
|
||||
strUsage += " -loadblock=<file> " + _("Imports blocks from external blk000??.dat file") + " " + _("on startup") + "\n";
|
||||
strUsage += " -maxorphanblocks=<n> " + strprintf(_("Keep at most <n> unconnectable blocks in memory (default: %u)"), DEFAULT_MAX_ORPHAN_BLOCKS) + "\n";
|
||||
strUsage += " -maxorphantx=<n> " + strprintf(_("Keep at most <n> unconnectable transactions in memory (default: %u)"), DEFAULT_MAX_ORPHAN_TRANSACTIONS) + "\n";
|
||||
strUsage += " -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) + "\n";
|
||||
strUsage += " -pid=<file> " + _("Specify pid file (default: dogecoind.pid)") + "\n";
|
||||
strUsage += " -reindex " + _("Rebuild block chain index from current blk000??.dat files") + " " + _("on startup") + "\n";
|
||||
|
||||
@ -1184,7 +1184,7 @@ uint256 static GetOrphanRoot(const uint256& hash)
|
||||
// Remove a random orphan block (which does not have any dependent orphans).
|
||||
void static PruneOrphanBlocks()
|
||||
{
|
||||
if (mapOrphanBlocksByPrev.size() <= MAX_ORPHAN_BLOCKS)
|
||||
if (mapOrphanBlocksByPrev.size() <= (size_t)std::max((int64_t)0, GetArg("-maxorphanblocks", DEFAULT_MAX_ORPHAN_BLOCKS)))
|
||||
return;
|
||||
|
||||
// Pick a random orphan block.
|
||||
@ -4121,7 +4121,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
AddOrphanTx(tx);
|
||||
|
||||
// DoS prevention: do not allow mapOrphanTransactions to grow unbounded
|
||||
unsigned int nEvicted = LimitOrphanTxSize(MAX_ORPHAN_TRANSACTIONS);
|
||||
unsigned int nMaxOrphanTx = (unsigned int)std::max((int64_t)0, GetArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
||||
unsigned int nEvicted = LimitOrphanTxSize(nMaxOrphanTx);
|
||||
if (nEvicted > 0)
|
||||
LogPrint("mempool", "mapOrphan overflow, removed %u tx\n", nEvicted);
|
||||
}
|
||||
|
||||
@ -52,6 +52,10 @@ static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
|
||||
static const unsigned int MAX_ORPHAN_TRANSACTIONS = MAX_BLOCK_SIZE/100;
|
||||
/** The maximum number of orphan blocks kept in memory */
|
||||
static const unsigned int MAX_ORPHAN_BLOCKS = 750;
|
||||
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
|
||||
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
|
||||
/** Default for -maxorphanblocks, maximum number of orphan blocks kept in memory */
|
||||
static const unsigned int DEFAULT_MAX_ORPHAN_BLOCKS = 750;
|
||||
/** The maximum size of a blk?????.dat file (since 0.8) */
|
||||
static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB
|
||||
/** The pre-allocation chunk size for blk?????.dat files (since 0.8) */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user