wallet: remove update argument from RescanFromTime method
What changed, and why it matters
This is a small code cleanup change in Bitcoin Core's wallet code. It removes an unused option (the 'update' argument) from a method called RescanFromTime. The only place that called this method always passed 'true', so the developer simplified the code by hardcoding that value and removing the parameter. There is no security issue here.
No action required. This is a benign refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors CWallet::RescanFromTime by removing its bool update parameter. The sole caller in importdescriptors always passed true, so the parameter was redundant. The change hardcodes fUpdate=true in the internal ScanForWalletTransactions call and updates the declaration accordingly. This is a pure refactoring with no behavioral change.
Changed components
src/wallet/rpc/backup.cppsrc/wallet/wallet.cppsrc/wallet/wallet.hInspect captured patch +4 / −4
diff --git a/src/wallet/rpc/backup.cpp b/src/wallet/rpc/backup.cpp
index 4b87ba23..7f3871ad 100644
--- a/src/wallet/rpc/backup.cpp
+++ b/src/wallet/rpc/backup.cpp
@@ -407,7 +407,7 @@ RPCMethod importdescriptors()
// Rescan the blockchain using the lowest timestamp
if (rescan) {
- int64_t scanned_time = pwallet->RescanFromTime(lowest_timestamp, reserver, /*update=*/true);
+ int64_t scanned_time = pwallet->RescanFromTime(lowest_timestamp, reserver);
pwallet->ResubmitWalletTransactions(node::TxBroadcast::MEMPOOL_NO_BROADCAST, /*force=*/true);
if (pwallet->IsAbortingRescan()) {
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 1b8f547f..13c06f85 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1824,7 +1824,7 @@ void CWallet::MaybeUpdateBirthTime(int64_t time)
* @return Earliest timestamp that could be successfully scanned from. Timestamp
* returned will be higher than startTime if relevant blocks could not be read.
*/
-int64_t CWallet::RescanFromTime(int64_t startTime, const WalletRescanReserver& reserver, bool update)
+int64_t CWallet::RescanFromTime(int64_t startTime, const WalletRescanReserver& reserver)
{
// Find starting block. May be null if nCreateTime is greater than the
// highest blockchain timestamp, in which case there is nothing that needs
@@ -1836,7 +1836,7 @@ int64_t CWallet::RescanFromTime(int64_t startTime, const WalletRescanReserver& r
if (start) {
// TODO: this should take into account failure by ScanResult::USER_ABORT
- ScanResult result = ScanForWalletTransactions(start_block, start_height, /*max_height=*/{}, reserver, /*fUpdate=*/update, /*save_progress=*/false);
+ ScanResult result = ScanForWalletTransactions(start_block, start_height, /*max_height=*/{}, reserver, /*fUpdate=*/true, /*save_progress=*/false);
if (result.status == ScanResult::FAILURE) {
int64_t time_max;
CHECK_NONFATAL(chain().findBlock(result.last_failed_block, FoundBlock().maxTime(time_max)));
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 45b9b8ab..73736ce6 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -628,7 +628,7 @@ public:
void blockConnected(const kernel::ChainstateRole& role, const interfaces::BlockInfo& block) override;
void blockDisconnected(const interfaces::BlockInfo& block) override;
void updatedBlockTip() override;
- int64_t RescanFromTime(int64_t startTime, const WalletRescanReserver& reserver, bool update);
+ int64_t RescanFromTime(int64_t startTime, const WalletRescanReserver& reserver);
struct ScanResult {
enum { SUCCESS, FAILURE, USER_ABORT } status = SUCCESS;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.