mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-04 04:45:10 +02:00
[wallet] Move getBlockHeight from Chain::Lock interface to simple Chain
Add HaveChain to assert chain access for wallet-tool in LoadToWallet.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user