Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 744 Lines • ▼ Show 20 Lines | private: | ||||
/** Internal database handle. */ | /** Internal database handle. */ | ||||
std::unique_ptr<WalletDatabase> database; | std::unique_ptr<WalletDatabase> database; | ||||
/** | /** | ||||
* The following is used to keep track of how far behind the wallet is | * The following is used to keep track of how far behind the wallet is | ||||
* from the chain sync, and to allow clients to block on us being caught up. | * from the chain sync, and to allow clients to block on us being caught up. | ||||
* | * | ||||
* Note that this is *not* how far we've processed, we may need some rescan | * Processed hash is a pointer on node's tip and doesn't imply that the | ||||
* to have seen all transactions in the chain, but is only used to track | * wallet has scanned sequentially all blocks up to this one. | ||||
* live BlockConnected callbacks. | |||||
*/ | */ | ||||
BlockHash m_last_block_processed GUARDED_BY(cs_wallet); | BlockHash m_last_block_processed GUARDED_BY(cs_wallet); | ||||
/* Height of last block processed is used by wallet to know depth of | |||||
* transactions without relying on Chain interface beyond asynchronous | |||||
* updates. For safety, we initialize it to -1. Height is a pointer on | |||||
* node's tip and doesn't imply that the wallet has scanned sequentially all | |||||
* blocks up to this one. | |||||
*/ | |||||
int m_last_block_processed_height GUARDED_BY(cs_wallet) = -1; | |||||
public: | public: | ||||
const CChainParams &chainParams; | const CChainParams &chainParams; | ||||
/* | /* | ||||
* Main wallet lock. | * Main wallet lock. | ||||
* This lock protects all the fields added by CWallet. | * This lock protects all the fields added by CWallet. | ||||
*/ | */ | ||||
mutable RecursiveMutex cs_wallet; | mutable RecursiveMutex cs_wallet; | ||||
▲ Show 20 Lines • Show All 591 Lines • ▼ Show 20 Lines | LegacyScriptPubKeyMan::CryptedKeyMap & | ||||
mapCryptedKeys GUARDED_BY(cs_KeyStore) = m_spk_man->mapCryptedKeys; | mapCryptedKeys GUARDED_BY(cs_KeyStore) = m_spk_man->mapCryptedKeys; | ||||
LegacyScriptPubKeyMan::WatchOnlySet & | LegacyScriptPubKeyMan::WatchOnlySet & | ||||
setWatchOnly GUARDED_BY(cs_KeyStore) = m_spk_man->setWatchOnly; | setWatchOnly GUARDED_BY(cs_KeyStore) = m_spk_man->setWatchOnly; | ||||
LegacyScriptPubKeyMan::WatchKeyMap & | LegacyScriptPubKeyMan::WatchKeyMap & | ||||
mapWatchKeys GUARDED_BY(cs_KeyStore) = m_spk_man->mapWatchKeys; | mapWatchKeys GUARDED_BY(cs_KeyStore) = m_spk_man->mapWatchKeys; | ||||
WalletBatch *& | WalletBatch *& | ||||
encrypted_batch GUARDED_BY(cs_wallet) = m_spk_man->encrypted_batch; | encrypted_batch GUARDED_BY(cs_wallet) = m_spk_man->encrypted_batch; | ||||
using CryptedKeyMap = LegacyScriptPubKeyMan::CryptedKeyMap; | using CryptedKeyMap = LegacyScriptPubKeyMan::CryptedKeyMap; | ||||
/** Get last block processed height */ | |||||
int GetLastBlockHeight() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { | |||||
AssertLockHeld(cs_wallet); | |||||
assert(m_last_block_processed_height >= 0); | |||||
return m_last_block_processed_height; | |||||
}; | |||||
/** Set last block processed height, currently only use in unit test */ | |||||
void SetLastBlockProcessed(int block_height, BlockHash block_hash) | |||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { | |||||
AssertLockHeld(cs_wallet); | |||||
m_last_block_processed_height = block_height; | |||||
m_last_block_processed = block_hash; | |||||
}; | |||||
}; | }; | ||||
/** | /** | ||||
* Called periodically by the schedule thread. Prompts individual wallets to | * Called periodically by the schedule thread. Prompts individual wallets to | ||||
* resend their transactions. Actual rebroadcast schedule is managed by the | * resend their transactions. Actual rebroadcast schedule is managed by the | ||||
* wallets themselves. | * wallets themselves. | ||||
*/ | */ | ||||
void MaybeResendWalletTxs(); | void MaybeResendWalletTxs(); | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |