From fad1e6bf238ef4693464faf4102934c5b2dc7cb2 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 24 Aug 2026 12:36:04 +0200 Subject: [PATCH] util: refactor: Remove deprecated SetMockTime(i64) alias The deprecated test-only alias is only used in three places and required in none. So remove it. --- src/rpc/node.cpp | 2 +- src/test/fuzz/fuzz.cpp | 2 +- src/util/time.cpp | 1 - src/util/time.h | 8 -------- src/wallet/interfaces.cpp | 2 +- 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/rpc/node.cpp b/src/rpc/node.cpp index 6d0d5511e33..84ffda05fdc 100644 --- a/src/rpc/node.cpp +++ b/src/rpc/node.cpp @@ -69,7 +69,7 @@ static RPCMethod setmocktime() throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Mocktime must be in the range [0, %s], not %s.", max_time, time)); } - SetMockTime(time); + SetMockTime(std::chrono::seconds{time}); const NodeContext& node_context{EnsureAnyNodeContext(request.context)}; for (const auto& chain_client : node_context.chain_clients) { chain_client->setMockTime(time); diff --git a/src/test/fuzz/fuzz.cpp b/src/test/fuzz/fuzz.cpp index 8c1def4338a..10e08ce0f6d 100644 --- a/src/test/fuzz/fuzz.cpp +++ b/src/test/fuzz/fuzz.cpp @@ -100,7 +100,7 @@ static void initialize() SeedRandomStateForTest(SeedRand::ZEROS); // Set time to the genesis block timestamp for deterministic initialization. - SetMockTime(1231006505); + SetMockTime(1231006505s); // Terminate immediately if a fuzzing harness ever tries to create a socket. // Individual tests can override this by pointing CreateSock to a mocked alternative. diff --git a/src/util/time.cpp b/src/util/time.cpp index 974eb051062..c0c621d14bd 100644 --- a/src/util/time.cpp +++ b/src/util/time.cpp @@ -49,7 +49,6 @@ NodeClock::time_point NodeClock::now() noexcept return time_point{ret}; }; -void SetMockTime(int64_t nMockTimeIn) { SetMockTime(std::chrono::seconds{nMockTimeIn}); } void SetMockTime(std::chrono::time_point mock) { SetMockTime(mock.time_since_epoch()); } void SetMockTime(std::chrono::seconds mock_time_in) { diff --git a/src/util/time.h b/src/util/time.h index 7df7c39a355..df025299f4f 100644 --- a/src/util/time.h +++ b/src/util/time.h @@ -112,14 +112,6 @@ using MillisecondsDouble = std::chrono::duration mock); diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index 0be97c460b2..812e9300af6 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -562,7 +562,7 @@ public: return StartWallets(m_context); } void stop() override { return UnloadWallets(m_context); } - void setMockTime(int64_t time) override { return SetMockTime(time); } + void setMockTime(int64_t time) override { return SetMockTime(std::chrono::seconds{time}); } void schedulerMockForward(std::chrono::seconds delta) override { Assert(m_context.scheduler)->MockForward(delta); } //! WalletLoader methods