Configuration argument handling improvements.

bitcoin/bitcoin: PR #36861

6 suggestions

Optional improvements

Link

[suggestion] · The negative -mempoolexpiry comment reverses expiration behavior

The new negative-expiry rejection is correct, but its comment describes indefinite retention where normally timestamped entries would instead expire on the next limiting pass.

Location: src/node/mempool_args.cpp:86 (head).

Details and suggested fix

LimitMempoolSize passes now - expiry to CTxMemPool::Expire, which removes entries whose entry time is strictly below that cutoff, together with their descendants. A negative duration puts the cutoff after now, so normally timestamped entries would qualify on the next limiting pass. LoadMempool uses the same cutoff to retain only newer entries. Reword the comment to say that negative expiry causes premature expiration rather than preventing expiration; keep the rejection unchanged.


Link

[suggestion] · Startup compatibility changes lack a release note

Configurations using -timeout=0 or -notimeout now fail instead of selecting the default, but no release note explains the migration.

Location: src/init.cpp:1174 (head).

Details and suggested fix

-timeout still allows negation, and the settings conversion maps it to zero. Base replaced that value with DEFAULT_CONNECT_TIMEOUT, while this hunk returns InitError. Although help already specified minimum: 1, timeout=0 and notimeout=1 previously selected a working default. Add a release note listing the newly enforced ranges and tell users relying on these timeout forms to remove the setting to retain the default. Distinguish this migration from other newly rejected values that already produced broken behavior.


Link

[suggestion] · Zero is documented as disabled despite enforcing zero thresholds

The commit message calls several zero settings "disabled", but their pre-existing behavior enforces zero thresholds instead, which can mislead operators about expiry, batching and tip recency.

Location: src/node/chainstatemanager_args.cpp:50 (head).

Details and suggested fix

Keep zero accepted for compatibility, but describe its actual per-option effects rather than uniformly calling it a disable switch. -maxtipage=0 requires a tip timestamp at or after now until IBD latches false; it does not bypass recency. -dbbatchsize=0 flushes after almost every cache entry, and -mempoolexpiry=0 expires entries older than the current second on a limiting pass. Zero buffer thresholds pause while queued memory is nonzero. -bantime=0 affects only bans using the default duration, giving them nBanUntil = now; it does not disable existing or explicitly timed bans.


Link

[suggestion] · The -bytespersigop tests omit the new upper boundary

The functional assertions would still pass if the new upper-bound comparison were removed, allowing 4294967296 to narrow to zero.

Location: test/functional/feature_config_args.py:233 (head).

Details and suggested fix

The rejection table tests -bytespersigop=-1, and the acceptance loop starts the node with zero. Neither assertion depends on the > UINT_MAX comparison; existing sigop-policy tests use ordinary positive values. Add -bytespersigop=4294967296 to the rejection table with the expected message Error: -bytespersigop must be between 0 and 4294967295 (got 4294967296). This directly covers the newly added upper-bound check.


Link

[suggestion] · Accepted mempool arguments are not checked for their applied values

The new unit helper discards populated MemPoolOptions, so it cannot detect accepted zero settings silently retaining defaults.

Location: src/test/mempool_tests.cpp:556 (head).

Details and suggested fix

For example, skipping the assignment specifically for -mempoolexpiry=0 would leave the default expiry while preserving this test's success assertion and the functional start/stop check. Have the helper propagate errors and return util::Result<kernel::MemPoolOptions> on success, following SetOptsFromArgs in validation_chainstatemanager_tests.cpp. Then assert the configured expiry and cluster limits, and distinguish max_datacarrier_bytes == 0 from std::nullopt when -datacarrier=0. Keep the existing rejection checks.


Link

[suggestion] · The timeout compatibility change is bundled with independent hardening

The single commit mixes help-only edits, wrap guards and a default-fallback compatibility change, making the -timeout decision harder to review or revert independently.

Location: src/init.cpp:1170 at aa8bfe2a137c (commit) (commit).

Details and suggested fix

Split aa8bfe2a137cceda68737c2874c5367f655dc5db into a mechanical help-placeholder commit, a -timeout fallback-to-error commit with its rejection test, and the remaining range guards with their tests. The timeout hunk turns default-equivalent configurations such as timeout=0 and -notimeout into startup errors, so it needs a compatibility decision separate from avoiding wraps. Keep the ReadCoinsViewArgs declaration, definition and error-propagating caller together, and introduce test_invalid_numeric_options with whichever group first uses it. This separation leaves final behavior unchanged while making the timeout decision independently reviewable and revertible.


Coverage details