aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/wallet.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2019-01-07 22:35:47 -0800
committerRussell Yanofsky <russ@yanofsky.org>2019-01-15 08:42:00 -0800
commitd93c4c1d6e0aab5f32306ecd7c1237257b26940d (patch)
treee11259962b2fdb58049057658bf924b4266ba892 /src/interfaces/wallet.cpp
parent700c42b85d20e624bef4228eef062c93084efab5 (diff)
downloadbitcoin-d93c4c1d6e0aab5f32306ecd7c1237257b26940d.tar.xz
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 <ben.woosley@gmail.com>
Diffstat (limited to 'src/interfaces/wallet.cpp')
-rw-r--r--src/interfaces/wallet.cpp9
1 files changed, 7 insertions, 2 deletions
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<int> 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;
}