From e2a47ce08528dfb39c0340145c6977f6afd587f6 Mon Sep 17 00:00:00 2001 From: Ivan Metlushko Date: Fri, 18 Dec 2020 17:45:11 +0100 Subject: refactor: move first run detection to client code --- src/wallet/wallet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wallet/wallet.h') diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 5a36d92784..a8ef200b2c 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1126,7 +1126,7 @@ public: CAmount GetChange(const CTransaction& tx) const; void chainStateFlushed(const CBlockLocator& loc) override; - DBErrors LoadWallet(bool& fFirstRunRet); + DBErrors LoadWallet(); DBErrors ZapSelectTx(std::vector& vHashIn, std::vector& vHashOut) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); bool SetAddressBook(const CTxDestination& address, const std::string& strName, const std::string& purpose); -- cgit v1.2.3 From 44c430ffac940e1d1dd7f5939a495470bc694489 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Fri, 14 Feb 2020 12:07:00 -0500 Subject: refactor: Add CWallet:::AttachChain method This commit does not change behavior, it just moves code from CWallet::CreateWalletFromFile to CWallet:::AttachChain so it can be updated in the next commit. This commit is most easily reviewed with "git diff -w --color-moved=dimmed_zebra" or by diffing CWallet:::AttachChain against the previous code with an external diff tool. --- src/wallet/wallet.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/wallet/wallet.h') diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index a8ef200b2c..ec1415bf10 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -763,6 +763,13 @@ private: bool CreateTransactionInternal(const std::vector& vecSend, CTransactionRef& tx, CAmount& nFeeRet, int& nChangePosInOut, bilingual_str& error, const CCoinControl& coin_control, FeeCalculation& fee_calc_out, bool sign); + /** + * Catch wallet up to current chain, scanning new blocks, updating the best + * block locator and m_last_block_processed, and registering for + * notifications about new blocks and transactions. + */ + static bool AttachChain(const std::shared_ptr& wallet, interfaces::Chain& chain, bilingual_str& error, std::vector& warnings); + public: /** * Main wallet lock. -- cgit v1.2.3 From 489ebb7b34c403a3ce78ff6fb271f8e6ecb47304 Mon Sep 17 00:00:00 2001 From: Ivan Metlushko Date: Mon, 18 Jan 2021 09:26:33 +0100 Subject: wallet: make chain optional for CWallet::Create --- src/wallet/wallet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wallet/wallet.h') diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index ec1415bf10..fc4edd8d20 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1209,7 +1209,7 @@ public: bool MarkReplaced(const uint256& originalHash, const uint256& newHash); /* Initializes the wallet, returns a new CWallet instance or a null pointer in case of an error */ - static std::shared_ptr Create(interfaces::Chain& chain, const std::string& name, std::unique_ptr database, uint64_t wallet_creation_flags, bilingual_str& error, std::vector& warnings); + static std::shared_ptr Create(interfaces::Chain* chain, const std::string& name, std::unique_ptr database, uint64_t wallet_creation_flags, bilingual_str& error, std::vector& warnings); /** * Wallet post-init setup -- cgit v1.2.3