aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorAntoine Riard <ariard@student.42.fr>2019-07-15 18:20:12 -0400
committerAntoine Riard <ariard@student.42.fr>2020-04-30 14:37:21 -0400
commitde13363a472ea30dff2f8f55c6ae572281115380 (patch)
tree7e220b1927512f48b0c39d6c0120e6e99e22074b /src/wallet/wallet.cpp
parentb855592d835bf4b3fb1263b88d4f96669a1722b1 (diff)
[wallet] Move getBlockHeight from Chain::Lock interface to simple Chain
Add HaveChain to assert chain access for wallet-tool in LoadToWallet.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 3be0453978..b7117e2e59 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -885,10 +885,9 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)
void CWallet::LoadToWallet(CWalletTx& wtxIn)
{
- // If wallet doesn't have a chain (e.g bitcoin-wallet), lock can't be taken.
- auto locked_chain = LockChain();
- if (locked_chain) {
- Optional<int> block_height = locked_chain->getBlockHeight(wtxIn.m_confirm.hashBlock);
+ // If wallet doesn't have a chain (e.g wallet-tool), don't bother to update txn.
+ if (HaveChain()) {
+ Optional<int> block_height = chain().getBlockHeight(wtxIn.m_confirm.hashBlock);
if (block_height) {
// Update cached block height variable since it not stored in the
// serialized transaction.