Skip to content

test: remove unused NodeClockContext default ctor#34871

Closed
w0xlt wants to merge 1 commit intobitcoin:masterfrom
w0xlt:test-nodeclockcontext-avoid-system-time
Closed

test: remove unused NodeClockContext default ctor#34871
w0xlt wants to merge 1 commit intobitcoin:masterfrom
w0xlt:test-nodeclockcontext-avoid-system-time

Conversation

@w0xlt
Copy link
Contributor

@w0xlt w0xlt commented Mar 19, 2026

NodeClockContext was introduced in #34479 as a small RAII helper for tests and fuzz targets: it sets mock node time on construction and resets the global mock time on destruction. The motivation there was to make mock-time usage less error-prone and to avoid mock time leaking from one fuzz input to the next.

All current in-tree uses of NodeClockContext pass an explicit time, e.g.

NodeClockContext clock_ctx{ConsumeTime(fuzzed_data_provider)};

The no-argument constructor is not used anywhere.

The no-argument NodeClockContext constructor is unused in-tree. Unlike the explicit constructors, it derives its value from Now<NodeSeconds>(), which makes the helper less clear for deterministic test and fuzz usage.

Drop the overload and keep NodeClockContext explicit: callers provide the mock time they want to scope and the helper continues to reset the global mock time on destruction.
@DrahtBot DrahtBot added the Tests label Mar 19, 2026
@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 19, 2026

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept NACK maflcko

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

@fanquake
Copy link
Member

cc @maflcko

@maflcko
Copy link
Member

maflcko commented Mar 20, 2026

NACK

Just because this happens to be unused on current master doesn't mean it is useless.

Removing it will introduce compile failures and silent conflicts with other pull requests that are using this, such as #34858

@fanquake
Copy link
Member

Closing for now.

@fanquake fanquake closed this Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants