Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 1,412 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void CWallet::UpdatedBlockTip() { | void CWallet::UpdatedBlockTip() { | ||||
m_best_block_time = GetTime(); | m_best_block_time = GetTime(); | ||||
} | } | ||||
void CWallet::BlockUntilSyncedToCurrentChain() { | void CWallet::BlockUntilSyncedToCurrentChain() { | ||||
AssertLockNotHeld(cs_wallet); | AssertLockNotHeld(cs_wallet); | ||||
{ | |||||
// Skip the queue-draining stuff if we know we're caught up with | // Skip the queue-draining stuff if we know we're caught up with | ||||
// ::ChainActive().Tip()... | // chainActive.Tip(), otherwise put a callback in the validation interface | ||||
// We could also take cs_wallet here, and call m_last_block_processed | // queue and wait for the queue to drain enough to execute it (indicating we | ||||
// protected by cs_wallet instead of cs_main, but as long as we need | // are caught up at least with the time we entered this function). | ||||
// cs_main here anyway, it's easier to just call it cs_main-protected. | const BlockHash last_block_hash = | ||||
auto locked_chain = chain().lock(); | WITH_LOCK(cs_wallet, return m_last_block_processed); | ||||
if (!m_last_block_processed.IsNull() && | chain().waitForNotificationsIfNewBlocksConnected(last_block_hash); | ||||
locked_chain->isPotentialTip(m_last_block_processed)) { | |||||
return; | |||||
} | |||||
} | |||||
// ...otherwise put a callback in the validation interface queue and wait | |||||
// for the queue to drain enough to execute it (indicating we are caught up | |||||
// at least with the time we entered this function). | |||||
chain().waitForNotifications(); | |||||
} | } | ||||
isminetype CWallet::IsMine(const CTxIn &txin) const { | isminetype CWallet::IsMine(const CTxIn &txin) const { | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
std::map<TxId, CWalletTx>::const_iterator mi = | std::map<TxId, CWalletTx>::const_iterator mi = | ||||
mapWallet.find(txin.prevout.GetTxId()); | mapWallet.find(txin.prevout.GetTxId()); | ||||
if (mi != mapWallet.end()) { | if (mi != mapWallet.end()) { | ||||
const CWalletTx &prev = (*mi).second; | const CWalletTx &prev = (*mi).second; | ||||
▲ Show 20 Lines • Show All 3,551 Lines • Show Last 20 Lines |