From 21333ce153c6509b6720c05c8331078a25789e97 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sat, 26 Jun 2021 15:49:47 -0400 Subject: [PATCH] Add -rescanheight --- src/init.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 2624945bf..ab4e1c0d8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -467,6 +467,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-opretmintxfee=", strprintf(_("Minimum fee (in %s/kB) to allow for OP_RETURN transactions (default: %s)"), CURRENCY_UNIT, 400000 )); strUsage += HelpMessageOpt("-paytxfee=", strprintf(_("Fee (in %s/kB) to add to transactions you send (default: %s)"), CURRENCY_UNIT, FormatMoney(payTxFee.GetFeePerK()))); strUsage += HelpMessageOpt("-rescan", _("Rescan the block chain for missing wallet transactions") + " " + _("on startup")); + strUsage += HelpMessageOpt("-rescanheight", _("Rescan from specified height when rescan=1 on startup")); strUsage += HelpMessageOpt("-salvagewallet", _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup")); strUsage += HelpMessageOpt("-sendfreetransactions", strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), 0)); strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), 1)); @@ -2074,6 +2075,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) { pwalletMain->ClearNoteWitnessCache(); pindexRescan = chainActive.Genesis(); + int rescanHeight = GetArg("-rescanheight", 0); + if (rescanHeight > 0) { + if (rescanHeight > chainActive.Tip()->GetHeight()) { + pindexRescan = chainActive.Tip(); + } else { + pindexRescan = chainActive[rescanHeight]; + } + } } else { CWalletDB walletdb(strWalletFile); CBlockLocator locator;