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.
-rescan
startup parameter
#23123
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)
0 bool dummy;
1 load_wallet_ret = wallet_instance->LoadWallet(/*rescan_required=*/dummy);
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)
Approach ACK 256314b984a215fab0cf16b13a234ae002e987c4
Didn’t review closely
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.
That requires changing https://github.com/bitcoin/bitcoin/blob/419afa93419e6840f78cb94b4a39d826eb10e139/src/wallet/wallet.cpp#L2546
A low effort alternative is to use pointer:
0DBErrors LoadWallet(bool* rescan_required = nullptr);
or overload
0DBErrors LoadWallet() { bool dummy; return LoadWallet(dummy); }
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
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.
DBErrors::RESCAN_REQUIRED
instead of an out bool, as suggested by @achow101
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