From cff8d114eaeab5ab0ae97ef1eae912c7b8bcbb9e Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 21 Dec 2021 20:55:29 -0500 Subject: [PATCH] Fix rescan RPC to correctly use the optional rescan height --- src/rpc/client.cpp | 1 + src/wallet/rpcdump.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 4da0e3744..916273043 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -36,6 +36,7 @@ public: static const CRPCConvertParam vRPCConvertParams[] = { + { "rescan", 0 }, { "stop", 0 }, { "setmocktime", 0 }, { "getaddednodeinfo", 0 }, diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index e5a7d2034..e24dfe15a 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -178,9 +178,12 @@ UniValue rescan(const UniValue& params, bool fHelp, const CPubKey& mypk) } LogPrintf("Rescanning from height=%d\n", nRescanHeight); - //pwalletMain->ScanForWalletTransactions(chainActive[nRescanHeight],true); - bool update = false; - pwalletMain->ScanForWalletTransactions(chainActive.Genesis(),update); + bool update = true; + if (nRescanHeight > 0) { + pwalletMain->ScanForWalletTransactions(chainActive[nRescanHeight],update); + } else { + pwalletMain->ScanForWalletTransactions(chainActive.Genesis(),update); + } //TODO: can we return something more useful? return NullUniValue; }