Remove the -rescan startup parameter.
Rescans can be run with the rescanblockchain RPC.
Rescans are still done on wallet-load if needed due to corruption, for example.
Remove the -rescan startup parameter.
Rescans can be run with the rescanblockchain RPC.
Rescans are still done on wallet-load if needed due to corruption, for example.
53 | @@ -54,7 +54,8 @@ static std::shared_ptr<CWallet> MakeWallet(const std::string& name, const fs::pa 54 | std::shared_ptr<CWallet> wallet_instance{new CWallet(nullptr /* chain */, name, std::move(database)), WalletToolReleaseWallet}; 55 | DBErrors load_wallet_ret; 56 | try { 57 | - load_wallet_ret = wallet_instance->LoadWallet(); 58 | + bool rescan_required = false; 59 | + load_wallet_ret = wallet_instance->LoadWallet(rescan_required);
nit: Could leave it uninitialized to clarify this is an unused out param? (Same for other places)
bool dummy;
load_wallet_ret = wallet_instance->LoadWallet(/*rescan_required=*/dummy);
Done :)
Concept ACK. See also #13044
90 | self.wait_until(lambda: len(os.listdir(self.walletnotify_dir)) == block_count, timeout=10) 91 | 92 | - # directory content should equal the generated transaction hashes 93 | - tx_details = list(map(lambda t: (t['txid'], t['blockheight'], t['blockhash']), self.nodes[1].listtransactions("*", block_count))) 94 | - self.stop_node(1) 95 | - self.expect_wallet_notify(tx_details)
shouldn't this be adjusted to test that the rescan RPC also notifies?
Good point, done.
Approach ACK 256314b984a215fab0cf16b13a234ae002e987c4
Didn't review closely
Concept ACK
utACK 256314b
Concept and code review ACK 256314b984a215fab0cf16b13a234ae002e987c4
657 | @@ -658,7 +658,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati 658 | CAmount GetDebit(const CTransaction& tx, const isminefilter& filter) const; 659 | void chainStateFlushed(const CBlockLocator& loc) override; 660 | 661 | - DBErrors LoadWallet(); 662 | + DBErrors LoadWallet(bool& rescan_required);
In a751305ed7d0e085d80c76dfe1b419858ce331df "Corrupt wallet tx shouldn't trigger rescan of all wallets"
It seems like it would be cleaner to add a DBErrors:RESCAN_REQUIRED instead of this rescan_required parameter and requiring a bunch of callers to provide a dummy bool.
I like this approach too.
That requires changing https://github.com/bitcoin/bitcoin/blob/419afa93419e6840f78cb94b4a39d826eb10e139/src/wallet/wallet.cpp#L2546
A low effort alternative is to use pointer:
DBErrors LoadWallet(bool* rescan_required = nullptr);
or overload
DBErrors LoadWallet() { bool dummy; return LoadWallet(dummy); }
I'll use a pointer as @promag suggests :+1: I was just erring on the side of caution when it came to hiding the parameter, so it wasn't accidentally ignored.
I really don't think it should be an out parameter since we have this enum for loading errors.
Ok fair enough, I'll use your approach
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
gArgs from wallet.h and wallet.cpp (2) by kiminuo)If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Modified second commit to use DBErrors::RESCAN_REQUIRED instead of an out bool, as suggested by @achow101
ACK dc3ec74d67abc85e8f724648f93efdd097e6f783
re-ACK dc3ec74d67abc85e8f724648f93efdd097e6f783
47 | @@ -48,7 +48,8 @@ enum class DBErrors 48 | NONCRITICAL_ERROR, 49 | TOO_NEW, 50 | LOAD_FAIL, 51 | - NEED_REWRITE 52 | + NEED_REWRITE, 53 | + RESCAN_REQUIRED
In commit "Corrupt wallet tx shouldn't trigger rescan of all wallets" (f963b0fa8cdd5223feb828c5faf6c57bc4107c8a)
Minor: Might call this NEED_RESCAN to be consistent with NEED_REWRITE
I think this is a good suggestion to be more consistent. Maybe in a follow-up PR.
Code review ACK dc3ec74d67abc85e8f724648f93efdd097e6f783. Looks great!
Merged here: 571bb94dfb5047c9be8fcbae5dae71de7256b86c