Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 789 Lines • ▼ Show 20 Lines | private: | ||||
bool AddCryptedKeyInner(const CPubKey &vchPubKey, | bool AddCryptedKeyInner(const CPubKey &vchPubKey, | ||||
const std::vector<uint8_t> &vchCryptedSecret); | const std::vector<uint8_t> &vchCryptedSecret); | ||||
bool AddKeyPubKeyInner(const CKey &key, const CPubKey &pubkey); | bool AddKeyPubKeyInner(const CKey &key, const CPubKey &pubkey); | ||||
std::atomic<bool> fAbortRescan{false}; | std::atomic<bool> fAbortRescan{false}; | ||||
// controlled by WalletRescanReserver | // controlled by WalletRescanReserver | ||||
std::atomic<bool> fScanningWallet{false}; | std::atomic<bool> fScanningWallet{false}; | ||||
std::atomic<int64_t> m_scanning_start{0}; | std::atomic<int64_t> m_scanning_start{0}; | ||||
std::atomic<double> m_scanning_progress{0}; | |||||
std::mutex mutexScanning; | std::mutex mutexScanning; | ||||
friend class WalletRescanReserver; | friend class WalletRescanReserver; | ||||
WalletBatch *encrypted_batch GUARDED_BY(cs_wallet) = nullptr; | WalletBatch *encrypted_batch GUARDED_BY(cs_wallet) = nullptr; | ||||
//! the current wallet version: clients below this version are not able to | //! the current wallet version: clients below this version are not able to | ||||
//! load the wallet | //! load the wallet | ||||
int nWalletVersion = FEATURE_BASE; | int nWalletVersion = FEATURE_BASE; | ||||
▲ Show 20 Lines • Show All 313 Lines • ▼ Show 20 Lines | public: | ||||
* Rescan abort properties | * Rescan abort properties | ||||
*/ | */ | ||||
void AbortRescan() { fAbortRescan = true; } | void AbortRescan() { fAbortRescan = true; } | ||||
bool IsAbortingRescan() { return fAbortRescan; } | bool IsAbortingRescan() { return fAbortRescan; } | ||||
bool IsScanning() { return fScanningWallet; } | bool IsScanning() { return fScanningWallet; } | ||||
int64_t ScanningDuration() const { | int64_t ScanningDuration() const { | ||||
return fScanningWallet ? GetTimeMillis() - m_scanning_start : 0; | return fScanningWallet ? GetTimeMillis() - m_scanning_start : 0; | ||||
} | } | ||||
double ScanningProgress() const { | |||||
return fScanningWallet ? double(m_scanning_progress) : 0; | |||||
} | |||||
/** | /** | ||||
* keystore implementation | * keystore implementation | ||||
* Generate a new key | * Generate a new key | ||||
*/ | */ | ||||
CPubKey GenerateNewKey(WalletBatch &batch, bool internal = false) | CPubKey GenerateNewKey(WalletBatch &batch, bool internal = false) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
//! Adds a key to the store, and saves it to disk. | //! Adds a key to the store, and saves it to disk. | ||||
▲ Show 20 Lines • Show All 541 Lines • ▼ Show 20 Lines | public: | ||||
bool reserve() { | bool reserve() { | ||||
assert(!m_could_reserve); | assert(!m_could_reserve); | ||||
std::lock_guard<std::mutex> lock(m_wallet->mutexScanning); | std::lock_guard<std::mutex> lock(m_wallet->mutexScanning); | ||||
if (m_wallet->fScanningWallet) { | if (m_wallet->fScanningWallet) { | ||||
return false; | return false; | ||||
} | } | ||||
m_wallet->m_scanning_start = GetTimeMillis(); | m_wallet->m_scanning_start = GetTimeMillis(); | ||||
m_wallet->m_scanning_progress = 0; | |||||
m_wallet->fScanningWallet = true; | m_wallet->fScanningWallet = true; | ||||
m_could_reserve = true; | m_could_reserve = true; | ||||
return true; | return true; | ||||
} | } | ||||
bool isReserved() const { | bool isReserved() const { | ||||
return (m_could_reserve && m_wallet->fScanningWallet); | return (m_could_reserve && m_wallet->fScanningWallet); | ||||
} | } | ||||
Show All 23 Lines |