From d93c4c1d6e0aab5f32306ecd7c1237257b26940d Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Mon, 7 Jan 2019 22:35:47 -0800 Subject: Add time methods to the Chain interface And use them to remove uses of chainActive and mapBlockIndex in wallet code This commit does not change behavior. Co-authored-by: Ben Woosley --- src/interfaces/wallet.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/interfaces/wallet.cpp') diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 489cf0981c..88c5db73a1 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -333,8 +333,13 @@ public: if (mi == m_wallet.mapWallet.end()) { return false; } - num_blocks = locked_chain->getHeight().value_or(-1); - block_time = ::chainActive.Tip()->GetBlockTime(); + if (Optional height = locked_chain->getHeight()) { + num_blocks = *height; + block_time = locked_chain->getBlockTime(*height); + } else { + num_blocks = -1; + block_time = -1; + } tx_status = MakeWalletTxStatus(*locked_chain, mi->second); return true; } -- cgit v1.2.3