From c5e59a96a8561b6a0bcaba0ede2d53dbaac113b0 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Fri, 28 Jul 2017 22:54:31 -0400 Subject: [PATCH] Remove uses of GetAdjustedTime in wallet code This commit does not change behavior. --- src/interfaces/chain.cpp | 2 ++ src/interfaces/chain.h | 3 +++ src/wallet/wallet.cpp | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index 4abb1e638f..a654f55f55 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -237,6 +238,7 @@ public: } bool getPruneMode() override { return ::fPruneMode; } bool p2pEnabled() override { return g_connman != nullptr; } + int64_t getAdjustedTime() override { return GetAdjustedTime(); } }; } // namespace diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index b4a458cba6..c5aa67d0d7 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -164,6 +164,9 @@ public: //! Check if p2p enabled. virtual bool p2pEnabled() = 0; + + //! Get adjusted time. + virtual int64_t getAdjustedTime() = 0; }; //! Interface to let node manage chain clients (wallets, or maybe tools for diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 8746fb556b..8452104745 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -940,7 +940,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose) wtx.BindWallet(this); bool fInsertedNew = ret.second; if (fInsertedNew) { - wtx.nTimeReceived = GetAdjustedTime(); + wtx.nTimeReceived = chain().getAdjustedTime(); wtx.nOrderPos = IncOrderPosNext(&batch); wtx.m_it_wtxOrdered = wtxOrdered.insert(std::make_pair(wtx.nOrderPos, &wtx)); wtx.nTimeSmart = ComputeTimeSmart(wtx);