aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-05-20 07:35:26 +0100
committerfanquake <fanquake@gmail.com>2022-05-20 07:48:07 +0100
commit6407c0e8a33f5a04eae4ebfb5befdcc1c2ab2b57 (patch)
treee12de5d04c2be4f17c6601101a02633e6eb67d0e /src/bitcoin-cli.cpp
parent0de36941eca1bff91420dd878eb097db2b1a596c (diff)
parentfa305fd92c0a5a91831be3ccec0a5ef962a5fbcb (diff)
downloadbitcoin-6407c0e8a33f5a04eae4ebfb5befdcc1c2ab2b57.tar.xz
Merge bitcoin/bitcoin#25101: Add mockable clock type
fa305fd92c0a5a91831be3ccec0a5ef962a5fbcb Add mockable clock type and TicksSinceEpoch helper (MarcoFalke) Pull request description: This will be used primarily by the addr time refactor (https://github.com/bitcoin/bitcoin/pull/24697) to make addr relay time type safe. However, it can also be used in other places, and can be reviewed independently, so I split it up. ACKs for top commit: jonatack: ACK fa305fd92c0a5a91831be3ccec0a5ef962a5fbcb per `git range-diff 7b3343f fa20781 fa305fd` ajtowns: ACK fa305fd92c0a5a91831be3ccec0a5ef962a5fbcb Tree-SHA512: da00200126833c1f55b1b1e68f596eab5c9254e82b188ad17779c08ffd685e198a7c5270791b4b69a858dc6ba4e051fe0c8b445d203d356d0c884f6365ee1cfe
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r--src/bitcoin-cli.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 4ff96727c6..88cbab1d11 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -44,7 +44,6 @@
// trivial to get the mocked time from the server, nor is it needed for now, so
// just use a plain system_clock.
using CliClock = std::chrono::system_clock;
-using CliSeconds = std::chrono::time_point<CliClock, std::chrono::seconds>;
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
UrlDecodeFn* const URL_DECODE = urlDecode;
@@ -470,7 +469,7 @@ public:
if (networkinfo["version"].getInt<int>() < 209900) {
throw std::runtime_error("-netinfo requires bitcoind server to be running v0.21.0 and up");
}
- const int64_t time_now{count_seconds(Now<CliSeconds>())};
+ const int64_t time_now{TicksSinceEpoch<std::chrono::seconds>(CliClock::now())};
// Count peer connection totals, and if DetailsRequested(), store peer data in a vector of structs.
for (const UniValue& peer : batch[ID_PEERINFO]["result"].getValues()) {