Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 1,923 Lines • ▼ Show 20 Lines | int64_t nMempoolSizeMin = | ||||
args.GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * | args.GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * | ||||
1000 * 40; | 1000 * 40; | ||||
if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin) { | if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin) { | ||||
return InitError(strprintf(_("-maxmempool must be at least %d MB"), | return InitError(strprintf(_("-maxmempool must be at least %d MB"), | ||||
std::ceil(nMempoolSizeMin / 1000000.0))); | std::ceil(nMempoolSizeMin / 1000000.0))); | ||||
} | } | ||||
// Configure excessive block size. | // Configure excessive block size. | ||||
const uint64_t nProposedExcessiveBlockSize = | const int64_t nProposedExcessiveBlockSize = | ||||
args.GetArg("-excessiveblocksize", DEFAULT_MAX_BLOCK_SIZE); | args.GetArg("-excessiveblocksize", DEFAULT_MAX_BLOCK_SIZE); | ||||
if (!config.SetMaxBlockSize(nProposedExcessiveBlockSize)) { | if (nProposedExcessiveBlockSize <= 0 || | ||||
!config.SetMaxBlockSize(nProposedExcessiveBlockSize)) { | |||||
return InitError( | return InitError( | ||||
_("Excessive block size must be > 1,000,000 bytes (1MB)")); | _("Excessive block size must be > 1,000,000 bytes (1MB)")); | ||||
} | } | ||||
// Check blockmaxsize does not exceed maximum accepted block size. | // Check blockmaxsize does not exceed maximum accepted block size. | ||||
const uint64_t nProposedMaxGeneratedBlockSize = | const int64_t nProposedMaxGeneratedBlockSize = | ||||
args.GetArg("-blockmaxsize", DEFAULT_MAX_GENERATED_BLOCK_SIZE); | args.GetArg("-blockmaxsize", DEFAULT_MAX_GENERATED_BLOCK_SIZE); | ||||
if (nProposedMaxGeneratedBlockSize > config.GetMaxBlockSize()) { | if (nProposedMaxGeneratedBlockSize <= 0) { | ||||
auto msg = _("Max generated block size (blockmaxsize) cannot exceed " | return InitError(_("Max generated block size must be greater than 0")); | ||||
"the excessive block size (excessiveblocksize)"); | } | ||||
return InitError(msg); | if (uint64_t(nProposedMaxGeneratedBlockSize) > config.GetMaxBlockSize()) { | ||||
return InitError(_("Max generated block size (blockmaxsize) cannot " | |||||
"exceed the excessive block size " | |||||
"(excessiveblocksize)")); | |||||
} | } | ||||
// block pruning; get the amount of disk space (in MiB) to allot for block & | // block pruning; get the amount of disk space (in MiB) to allot for block & | ||||
// undo files | // undo files | ||||
int64_t nPruneArg = args.GetArg("-prune", 0); | int64_t nPruneArg = args.GetArg("-prune", 0); | ||||
if (nPruneArg < 0) { | if (nPruneArg < 0) { | ||||
return InitError( | return InitError( | ||||
_("Prune cannot be configured with a negative value.")); | _("Prune cannot be configured with a negative value.")); | ||||
▲ Show 20 Lines • Show All 1,071 Lines • Show Last 20 Lines |