diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-05-30 15:55:17 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2018-11-06 11:44:40 -0400 |
commit | 8db11dd0b182a93042899651545cc21b34bf0742 (patch) | |
tree | 8165f7a88f2f56cca4d152c5e4fc0d2e5743bc54 /src/wallet/wallet.h | |
parent | 7e2e62cf7c513bd7d8e784069c5534fda1c50c52 (diff) | |
download | bitcoin-8db11dd0b182a93042899651545cc21b34bf0742.tar.xz |
Pass chain and client variables where needed
This commit does not change behavior. All it does is pass new function
parameters.
It is easiest to review this change with:
git log -p -n1 -U0 --word-diff-regex=.
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r-- | src/wallet/wallet.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 74eaa09506..32cd462c4c 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -33,6 +33,10 @@ #include <utility> #include <vector> +namespace interfaces { +class Chain; +} // namespace interfaces + bool AddWallet(const std::shared_ptr<CWallet>& wallet); bool RemoveWallet(const std::shared_ptr<CWallet>& wallet); bool HasWallets(); @@ -676,6 +680,9 @@ private: */ bool AddWatchOnly(const CScript& dest) override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); + /** Interface for accessing chain state. */ + interfaces::Chain& m_chain; + /** Wallet location which includes wallet name (see WalletLocation). */ WalletLocation m_location; @@ -737,7 +744,7 @@ public: unsigned int nMasterKeyMaxID = 0; /** Construct wallet with specified name and database implementation. */ - CWallet(const WalletLocation& location, std::unique_ptr<WalletDatabase> database) : m_location(location), database(std::move(database)) + CWallet(interfaces::Chain& chain, const WalletLocation& location, std::unique_ptr<WalletDatabase> database) : m_chain(chain), m_location(location), database(std::move(database)) { } @@ -759,6 +766,9 @@ public: std::set<COutPoint> setLockedCoins GUARDED_BY(cs_wallet); + /** Interface for accessing chain state. */ + interfaces::Chain& chain() const { return m_chain; } + const CWalletTx* GetWalletTx(const uint256& hash) const; //! check whether we are allowed to upgrade (or already support) to the named feature @@ -1057,10 +1067,10 @@ public: bool MarkReplaced(const uint256& originalHash, const uint256& newHash); //! Verify wallet naming and perform salvage on the wallet if required - static bool Verify(const WalletLocation& location, bool salvage_wallet, std::string& error_string, std::string& warning_string); + static bool Verify(interfaces::Chain& chain, const WalletLocation& location, bool salvage_wallet, std::string& error_string, std::string& warning_string); /* Initializes the wallet, returns a new CWallet instance or a null pointer in case of an error */ - static std::shared_ptr<CWallet> CreateWalletFromFile(const WalletLocation& location, uint64_t wallet_creation_flags = 0); + static std::shared_ptr<CWallet> CreateWalletFromFile(interfaces::Chain& chain, const WalletLocation& location, uint64_t wallet_creation_flags = 0); /** * Wallet post-init setup |