Fix rescan RPC to correctly use the optional rescan height

This commit is contained in:
Duke Leto
2021-12-21 20:55:29 -05:00
parent fffa06d138
commit cff8d114ea
2 changed files with 7 additions and 3 deletions

View File

@@ -36,6 +36,7 @@ public:
static const CRPCConvertParam vRPCConvertParams[] =
{
{ "rescan", 0 },
{ "stop", 0 },
{ "setmocktime", 0 },
{ "getaddednodeinfo", 0 },

View File

@@ -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;
}