Skip to content

Commit bccd1d9

Browse files
committed
Remove -rescan startup parameter
1 parent f963b0f commit bccd1d9

File tree

12 files changed

+26
-36
lines changed

12 files changed

+26
-36
lines changed

share/examples/bitcoin.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
#coinstatsindex=1
158158

159159
# Enable pruning to reduce storage requirements by deleting old blocks.
160-
# This mode is incompatible with -txindex, -coinstatsindex and -rescan.
160+
# This mode is incompatible with -txindex and -coinstatsindex.
161161
# 0 = default (no pruning).
162162
# 1 = allows manual pruning via RPC.
163163
# >=550 = target to stay under in MiB.

src/dummywallet.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ void DummyWalletInit::AddWalletOptions(ArgsManager& argsman) const
3939
"-maxtxfee=<amt>",
4040
"-mintxfee=<amt>",
4141
"-paytxfee=<amt>",
42-
"-rescan",
4342
"-signer=<cmd>",
4443
"-spendzeroconfchange",
4544
"-txconfirmtarget=<n>",

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ void SetupServerArgs(ArgsManager& argsman)
397397
-GetNumCores(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
398398
argsman.AddArg("-persistmempool", strprintf("Whether to save the mempool on shutdown and load on restart (default: %u)", DEFAULT_PERSIST_MEMPOOL), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
399399
argsman.AddArg("-pid=<file>", strprintf("Specify pid file. Relative paths will be prefixed by a net-specific datadir location. (default: %s)", BITCOIN_PID_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
400-
argsman.AddArg("-prune=<n>", strprintf("Reduce storage requirements by enabling pruning (deleting) of old blocks. This allows the pruneblockchain RPC to be called to delete specific blocks, and enables automatic pruning of old blocks if a target size in MiB is provided. This mode is incompatible with -txindex, -coinstatsindex and -rescan. "
400+
argsman.AddArg("-prune=<n>", strprintf("Reduce storage requirements by enabling pruning (deleting) of old blocks. This allows the pruneblockchain RPC to be called to delete specific blocks, and enables automatic pruning of old blocks if a target size in MiB is provided. This mode is incompatible with -txindex and -coinstatsindex. "
401401
"Warning: Reverting this setting requires re-downloading the entire blockchain. "
402402
"(default: 0 = disable pruning blocks, 1 = allow manual pruning via RPC, >=%u = automatically prune block files to stay under the specified target size in MiB)", MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
403403
argsman.AddArg("-reindex", "Rebuild chain state and block index from the blk*.dat files on disk", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);

src/wallet/init.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ void WalletInit::AddWalletOptions(ArgsManager& argsman) const
6262
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MINFEE)), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
6363
argsman.AddArg("-paytxfee=<amt>", strprintf("Fee rate (in %s/kvB) to add to transactions you send (default: %s)",
6464
CURRENCY_UNIT, FormatMoney(CFeeRate{DEFAULT_PAY_TX_FEE}.GetFeePerK())), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
65-
argsman.AddArg("-rescan", "Rescan the block chain for missing wallet transactions on startup", ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
6665
#ifdef ENABLE_EXTERNAL_SIGNER
6766
argsman.AddArg("-signer=<cmd>", "External signing tool, see doc/external-signer.md", ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
6867
#endif

src/wallet/rpcdump.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ RPCHelpMan importmulti()
14391439
"and coins using this key may not appear in the wallet. This error could be "
14401440
"caused by pruning or data corruption (see bitcoind log for details) and could "
14411441
"be dealt with by downloading and rescanning the relevant blocks (see -reindex "
1442-
"and -rescan options).",
1442+
"option and rescanblockchain RPC).",
14431443
GetImportTimestamp(request, now), scannedTime - TIMESTAMP_WINDOW - 1, TIMESTAMP_WINDOW)));
14441444
response.push_back(std::move(result));
14451445
}
@@ -1744,7 +1744,7 @@ RPCHelpMan importdescriptors()
17441744
"and coins using this desc may not appear in the wallet. This error could be "
17451745
"caused by pruning or data corruption (see bitcoind log for details) and could "
17461746
"be dealt with by downloading and rescanning the relevant blocks (see -reindex "
1747-
"and -rescan options).",
1747+
"option and rescanblockchain RPC).",
17481748
GetImportTimestamp(request, now), scanned_time - TIMESTAMP_WINDOW - 1, TIMESTAMP_WINDOW)));
17491749
response.push_back(std::move(result));
17501750
}

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,7 @@ static RPCHelpMan loadwallet()
26322632
return RPCHelpMan{"loadwallet",
26332633
"\nLoads a wallet from a wallet file or directory."
26342634
"\nNote that all wallet command-line options used when starting bitcoind will be"
2635-
"\napplied to the new wallet (eg -rescan, etc).\n",
2635+
"\napplied to the new wallet.\n",
26362636
{
26372637
{"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet directory or .dat file."},
26382638
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED_NAMED_ARG, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},

src/wallet/salvage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool RecoverDatabaseFile(const fs::path& file_path, bilingual_str& error, std::v
4545
// Call Salvage with fAggressive=true to
4646
// get as much data as possible.
4747
// Rewrite salvaged data to fresh wallet file
48-
// Set -rescan so any missing transactions will be
48+
// Rescan so any missing transactions will be
4949
// found.
5050
int64_t now = GetTime();
5151
std::string newFilename = strprintf("%s.%d.bak", filename, now);

src/wallet/test/wallet_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ BOOST_FIXTURE_TEST_CASE(importmulti_rescan, TestChain100Setup)
232232
"seconds of key creation, and could contain transactions pertaining to the key. As a result, "
233233
"transactions and coins using this key may not appear in the wallet. This error could be caused "
234234
"by pruning or data corruption (see bitcoind log for details) and could be dealt with by "
235-
"downloading and rescanning the relevant blocks (see -reindex and -rescan "
236-
"options).\"}},{\"success\":true}]",
235+
"downloading and rescanning the relevant blocks (see -reindex option and rescanblockchain "
236+
"RPC).\"}},{\"success\":true}]",
237237
0, oldTip->GetBlockTimeMax(), TIMESTAMP_WINDOW));
238238
RemoveWallet(context, wallet, /* load_on_start= */ std::nullopt);
239239
}

src/wallet/wallet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
16001600
WalletLogPrintf("Rescan started from block %s...\n", start_block.ToString());
16011601

16021602
fAbortRescan = false;
1603-
ShowProgress(strprintf("%s " + _("Rescanning…").translated, GetDisplayName()), 0); // show rescan progress in GUI as dialog or on splashscreen, if -rescan on startup
1603+
ShowProgress(strprintf("%s " + _("Rescanning…").translated, GetDisplayName()), 0); // show rescan progress in GUI as dialog or on splashscreen, if rescan required on startup (e.g. due to corruption)
16041604
uint256 tip_hash = WITH_LOCK(cs_wallet, return GetLastBlockHash());
16051605
uint256 end_hash = tip_hash;
16061606
if (max_height) chain().findAncestorByHeight(tip_hash, *max_height, FoundBlock().hash(end_hash));
@@ -2794,9 +2794,9 @@ bool CWallet::AttachChain(const std::shared_ptr<CWallet>& walletInstance, interf
27942794
// interface.
27952795
walletInstance->m_chain_notifications_handler = walletInstance->chain().handleNotifications(walletInstance);
27962796

2797-
// If either rescan_required = true or -rescan is set, rescan_height remains equal to 0
2797+
// If rescan_required = true, rescan_height remains equal to 0
27982798
int rescan_height = 0;
2799-
if (!rescan_required && !gArgs.GetBoolArg("-rescan", false))
2799+
if (!rescan_required)
28002800
{
28012801
WalletBatch batch(walletInstance->GetDatabase());
28022802
CBlockLocator locator;

test/functional/feature_notifications.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def setup_network(self):
4242
f"-alertnotify=echo > {os.path.join(self.alertnotify_dir, '%s')}",
4343
f"-blocknotify=echo > {os.path.join(self.blocknotify_dir, '%s')}",
4444
], [
45-
"-rescan",
4645
f"-walletnotify=echo %h_%b > {os.path.join(self.walletnotify_dir, notify_outputname('%w', '%s'))}",
4746
]]
4847
self.wallet_names = [self.default_wallet_name, self.wallet]
@@ -91,16 +90,15 @@ def run_test(self):
9190

9291
# directory content should equal the generated transaction hashes
9392
tx_details = list(map(lambda t: (t['txid'], t['blockheight'], t['blockhash']), self.nodes[1].listtransactions("*", block_count)))
94-
self.stop_node(1)
9593
self.expect_wallet_notify(tx_details)
9694

9795
self.log.info("test -walletnotify after rescan")
98-
# restart node to rescan to force wallet notifications
99-
self.start_node(1)
100-
self.connect_nodes(0, 1)
101-
96+
# rescan to force wallet notifications
97+
self.nodes[1].rescanblockchain()
10298
self.wait_until(lambda: len(os.listdir(self.walletnotify_dir)) == block_count, timeout=10)
10399

100+
self.connect_nodes(0, 1)
101+
104102
# directory content should equal the generated transaction hashes
105103
tx_details = list(map(lambda t: (t['txid'], t['blockheight'], t['blockhash']), self.nodes[1].listtransactions("*", block_count)))
106104
self.expect_wallet_notify(tx_details)

0 commit comments

Comments
 (0)