Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 911 Lines • ▼ Show 20 Lines | if (!strCmd.empty()) { | ||||
t.detach(); | t.detach(); | ||||
} | } | ||||
#endif | #endif | ||||
return true; | return true; | ||||
} | } | ||||
void CWallet::LoadToWallet(CWalletTx &wtxIn) { | void CWallet::LoadToWallet(CWalletTx &wtxIn) { | ||||
// If wallet doesn't have a chain (e.g bitcoin-wallet), lock can't be taken. | // If wallet doesn't have a chain (e.g wallet-tool), don't bother to update | ||||
auto locked_chain = LockChain(); | // txn. | ||||
if (locked_chain) { | if (HaveChain()) { | ||||
Optional<int> block_height = | Optional<int> block_height = | ||||
locked_chain->getBlockHeight(wtxIn.m_confirm.hashBlock); | chain().getBlockHeight(wtxIn.m_confirm.hashBlock); | ||||
if (block_height) { | if (block_height) { | ||||
// Update cached block height variable since it not stored in the | // Update cached block height variable since it not stored in the | ||||
// serialized transaction. | // serialized transaction. | ||||
wtxIn.m_confirm.block_height = *block_height; | wtxIn.m_confirm.block_height = *block_height; | ||||
} else if (wtxIn.isConflicted() || wtxIn.isConfirmed()) { | } else if (wtxIn.isConflicted() || wtxIn.isConfirmed()) { | ||||
// If tx block (or conflicting block) was reorged out of chain | // If tx block (or conflicting block) was reorged out of chain | ||||
// while the wallet was shutdown, change tx status to UNCONFIRMED | // while the wallet was shutdown, change tx status to UNCONFIRMED | ||||
// and reset block height, hash, and index. ABANDONED tx don't have | // and reset block height, hash, and index. ABANDONED tx don't have | ||||
▲ Show 20 Lines • Show All 3,836 Lines • Show Last 20 Lines |